#include <Thread.h>
Inheritance diagram for clawsoft::Thread:
Public Types | |
enum | SchedPolicy { NORMAL, ROUND_ROBIN, FIFO } |
Public Methods | |
Thread () | |
Default constructor. | |
virtual | ~Thread () |
This is the class destructor, it simply calls detach for cleanup purposes. | |
int | start () |
Call this method when you want to start running your thread. | |
virtual void * | run ()=0 |
Very important You must override this method so you can provide the thread process itself whatever you define this method does in your subclass is what the thread will start doing when you call start() | |
void | killMe () |
This method detaches the thread from the current running program, just like detach() does. | |
bool | isRunning () |
Use this method to verify if your thread is running;. | |
void | setSchedulingPolicy (SchedPolicy pol=NORMAL) |
This method will set the scheduling policy for the current thread, there are two types scheduling policies: * Realtime * Non-realtime Realtime policies are the ROUND_ROBIN and FIFO Non-realime is called NORMAL. | |
void | setPriority (int prio) |
Use this method to set the priority for the current scheduling policy. | |
const char * | getClassName () |
Returns the name of the current class. | |
Static Public Methods | |
int | installedCPUs () |
This will return how many CPUs are installed in the system. | |
double | cpuSpeed () |
This will return the CPU speed in megahertz. | |
int | totalMemory () |
Will return the total amount of system memory. | |
int | freeMemory () |
Will return the total amount of free system memory. | |
void | usleep (Uint32 usec) |
Will freeze the software for usec microseconds. | |
Data Fields | |
bool | autodetach |
This variable is just for knowing if the thread can be autodetached or no, currently it does nothing, but is here for backward compatibility. | |
Protected Methods | |
int | _start () |
This is a wrapper and is intended to be used only for derived classes. | |
void | detach () |
This method detaches the thread from the current running program. | |
void | setClassName (const char *n) |
Call this method when you need to set the name of the class you're creating, typically in it's constructor, remember that you must set the classname for every class you create, that way you can have more information while debugging. | |
Static Private Methods | |
void * | runMethod (void *thethread) |
This is the wrapping function which calls the run method so it can be executed as a thread, for GNU Pth this function must return an int. | |
Private Attributes | |
bool | _running |
This flag will say if this thread is running or not. | |
pthread_t | thread |
Thread identifier this one is used when GNU Pth has been activated. | |
pthread_attr_t | t_attr |
This member will hold the attributes for the current thread. |
|
|
|
Default constructor.
|
|
This is the class destructor, it simply calls detach for cleanup purposes.
|
|
This is a wrapper and is intended to be used only for derived classes.
|
|
This will return the CPU speed in megahertz.
|
|
This method detaches the thread from the current running program.
|
|
Will return the total amount of free system memory.
|
|
Returns the name of the current class.
|
|
This will return how many CPUs are installed in the system.
|
|
Use this method to verify if your thread is running;.
|
|
This method detaches the thread from the current running program, just like detach() does.
|
|
Very important
Implemented in clawsoft::AutomatedGC. |
|
This is the wrapping function which calls the run method so it can be executed as a thread, for GNU Pth this function must return an int.
|
|
Call this method when you need to set the name of the class you're creating, typically in it's constructor, remember that you must set the classname for every class you create, that way you can have more information while debugging.
|
|
Use this method to set the priority for the current scheduling policy.
|
|
This method will set the scheduling policy for the current thread, there are two types scheduling policies: * Realtime * Non-realtime Realtime policies are the ROUND_ROBIN and FIFO Non-realime is called NORMAL.
|
|
Call this method when you want to start running your thread.
|
|
Will return the total amount of system memory.
|
|
Will freeze the software for usec microseconds.
|
|
This flag will say if this thread is running or not.
|
|
This variable is just for knowing if the thread can be autodetached or no, currently it does nothing, but is here for backward compatibility.
|
|
This member will hold the attributes for the current thread.
|
|
Thread identifier this one is used when GNU Pth has been activated.
|
Authors:
Juan V. Guerrero
Jannette C. Mejia
Juan C. Guevara
Powered by: