RTXI  2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
RT::System Class Reference

#include <rt.h>

Classes

class  SetPeriodEvent
 

Public Member Functions

long long getPeriod (void) const
 
int setPeriod (long long period)
 
void foreachDevice (void(*callback)(Device *, void *), void *param)
 
void foreachThread (void(*callback)(Thread *, void *), void *param)
 
int postEvent (Event *event, bool blocking=true)
 

Static Public Member Functions

static SystemgetInstance (void)
 

Private Member Functions

 System (void)
 
 ~System (void)
 
 System (const System &)
 
Systemoperator= (const System &)
 
void insertDevice (Device *)
 
void removeDevice (Device *)
 
void insertThread (Thread *)
 
void removeThread (Thread *)
 
void execute (void)
 

Static Private Member Functions

static void * bounce (void *)
 

Private Attributes

Mutex deviceMutex
 
Mutex threadMutex
 
bool finished
 
pthread_t thread
 
RT::OS::Task task
 
long long period
 
List< RT::Devicedevices
 
List< RT::ThreadthreadList
 
Fifo eventFifo
 

Static Private Attributes

static Systeminstance = 0
 

Friends

class Device
 
class Thread
 

Detailed Description

Manages the RTOS as well as all objects that require realtime execution.

Definition at line 371 of file rt.h.

Constructor & Destructor Documentation

RT::System::System(void )
private

Definition at line 163 of file rt.cpp.

RT::System::~System(void )
private

Definition at line 181 of file rt.cpp.

RT::System::System(const System)
inlineprivate

Definition at line 445 of file rt.h.

Member Function Documentation

void * RT::System::bounce(void * param)
staticprivate

Definition at line 304 of file rt.cpp.

void RT::System::execute(void )
private

Definition at line 313 of file rt.cpp.

void RT::System::foreachDevice(void(*)(Device *, void *) callback,
void * param 
)

Loop through each Device and executes a callback. The callback takes two parameters, a Device pointer and param, the second parameter to foreachDevice.

Parameters
callbackThe callback function.
paramA parameter to the callback function.
See also
RT::Device

Definition at line 204 of file rt.cpp.

void RT::System::foreachThread(void(*)(Thread *, void *) callback,
void * param 
)

Loop through each Thread and executes a callback. The callback takes two parameters, a Thread pointer and param, the second parameter to foreachThread.

Parameters
callbackThe callback function
paramA parameter to the callback function
See also
RT::Thread

Definition at line 211 of file rt.cpp.

RT::System * RT::System::getInstance(void )
static

System is a Singleton, which means that there can only be one instance. This function returns a pointer to that single instance.

Returns
The instance of System.

Definition at line 361 of file rt.cpp.

long long RT::System::getPeriod(void )const
inline

Get the current period of the System in nanoseconds.

Returns
The current period

Definition at line 392 of file rt.h.

void RT::System::insertDevice(RT::Devicedevice)
private

Definition at line 229 of file rt.cpp.

void RT::System::insertThread(RT::Threadthread)
private

Definition at line 263 of file rt.cpp.

System& RT::System::operator=(const System)
inlineprivate

Definition at line 446 of file rt.h.

int RT::System::postEvent(RT::Eventevent,
bool blocking = true 
)

Post an Event for execution by the realtime task, this acts as a mechanism to synchronizing with the realtime task.

Parameters
eventThe event to be posted.
blockingIf true the call to postEvent is blocking.
Returns
The value returned from event->callback()
See also
RT:Event

Definition at line 218 of file rt.cpp.

void RT::System::removeDevice(RT::Devicedevice)
private

Definition at line 246 of file rt.cpp.

void RT::System::removeThread(RT::Threadthread)
private

Definition at line 287 of file rt.cpp.

int RT::System::setPeriod(long long period)

Set a new period for the System in nanoseconds.

Parameters
periodThe new desired period.
Returns
0 on success, A negative value upon failure.

Definition at line 188 of file rt.cpp.

Friends And Related Function Documentation

friend class Device
friend

Definition at line 374 of file rt.h.

friend class Thread
friend

Definition at line 375 of file rt.h.

Member Data Documentation

Mutex RT::System::deviceMutex
private

Definition at line 470 of file rt.h.

List<RT::Device> RT::System::devices
private

Definition at line 486 of file rt.h.

Fifo RT::System::eventFifo
private

Definition at line 489 of file rt.h.

bool RT::System::finished
private

Definition at line 481 of file rt.h.

RT::System * RT::System::instance = 0
staticprivate

Definition at line 468 of file rt.h.

long long RT::System::period
private

Definition at line 484 of file rt.h.

RT::OS::Task RT::System::task
private

Definition at line 483 of file rt.h.

pthread_t RT::System::thread
private

Definition at line 482 of file rt.h.

List<RT::Thread> RT::System::threadList
private

Definition at line 487 of file rt.h.

Mutex RT::System::threadMutex
private

Definition at line 474 of file rt.h.


The documentation for this class was generated from the following files: