Components/Libraries/XF/FreeRTOS/Thread

From UIT
Jump to: navigation, search

Contents

Thread

This class is the basic thread of the XFOS. It manages state machines, dispatch the events and schedule timeouts when an event need it. This class contains an event queue where a put events waiting for process.

Member Attributes

Queue _eventQueue : the event queue of the Thread

TimerManager* _pTimerManager : a pointer to the timer manager

Member Functions Documentation

Thread(TimerManager* opTimerManager, std::string oName, PRIORITY_SIZE oPriority, STACKSIZE_SIZE oStackDepth)

Description

The constructor of the Thread. It create the Thread and initialuîze the event queue.

Parameters

TimerManager* opTimerManager : a pointer to the timer manager

string oName  : the name of the thread (basically set as "Event Dispatcher")

PRIORITY_SIZE oPriority : the priority of the thread

STACKSIZE_SIZE oStackDepth : the stack size of the thread (basically set as THREAD_STACK_SIZE)

~Thread() [virtual]

Description

The destructor of the Thread

void pushEvent(Event* opEv, timeSize oTimeToWait) [virtual]

Description

If the event to push has a delay of 0, this function add it in the event queue. If the event needs a delay, this function schedule a timeout to the TimerManager and don't add the event in the queue.

Parameters

Event* opEv : a pointer to the event to push

timeSize oTimeToWait : the time (in ms) to wait if event queue is full (basically set as INFINIT_TIME)

timeoutIndication(Event* opEv)

Description

This method is called by the timer manager when the the delay of an event ends

Parameters

Event* opEv : the event whose the delay ends

void threadMain()

Description

This is the main function of the thread. It get the first event of the event queue and dispatch it to the good state machine

void scheduleTimeout(Event* opEv)

Description

Call the timer manager to schedule a timeout for the delay of an event

Parameters

Event* opEv : a pointer to the event that needs a delay

void dispatchEvent(Event* opEv) [virtual]

Description

The event to the good state machine to process it

Parameters

Event* opEv : the event to dispatch

void deleteEvent(Event* opEv)

Description

Delete the given event

Parameters

Event* opEv : the event to delete

Personal tools
Namespaces
Variants
Actions
Navigation
Browse
Toolbox