Home | C-Bits Package Documentation | Project Page |
#include <Thread_WIN32.h>
Inheritance diagram for cbits::Thread_WIN32:
Public Types | |
enum | State { READY = 1, ALIVE = 2, DEAD = 3 } |
Thread states. More... | |
enum | Priority { PRIORITY_1 = 1, PRIORITY_2 = 2, PRIORITY_3 = 3, PRIORITY_4 = 4, PRIORITY_5 = 5, PRIORITY_6 = 6, PRIORITY_7 = 7, PRIORITY_8 = 8, PRIORITY_9 = 9, MIN_PRIORITY = PRIORITY_1, DEFAULT_PRIORITY = PRIORITY_5, MAX_PRIORITY = PRIORITY_9 } |
Thread scheduling priorities. More... | |
Public Methods | |
Thread_WIN32 (Runnable *r, const Priority p=DEFAULT_PRIORITY) | |
virtual | ~Thread_WIN32 () |
void | start () |
Start the thread. More... | |
const long | getThreadID () const |
Get Thread's ID. More... | |
void | interrupt () |
Send a event to the thread. More... | |
const bool | join (const long msec=0) |
Wait for this thread to terminate. More... | |
const State | getState (const bool lockit=true) const |
Get this thread's run state. More... | |
void | setData (void *) const |
Associate user data with this thread. More... | |
void * | getData () const |
Retrieve user data that has been associated with this thread (if any). More... | |
Static Public Methods | |
Thread * | get_current_thread () |
void | yield () |
Give up the processor. More... | |
Thread * | create (Runnable *r, const Priority p=DEFAULT_PRIORITY) |
Factory method for creating thread objects. More... | |
Thread * | getCurrent () |
Get reference to the current thread of execution. More... | |
const bool | isInterrupted () |
Check the interrupt status of the current thread. More... | |
void | sleep (const long msec) |
Put current thread to sleep. More... | |
Protected Methods | |
virtual const bool | impl_create_thread (const Priority) |
Create a platform-specific thread. More... | |
virtual const bool | impl_start_thread () |
Start the platform-specific thread. More... | |
virtual const long | impl_get_threadid () const |
Get thread's ID. More... | |
virtual void | impl_lock_obj () const |
Lock this thread object. More... | |
virtual void | impl_unlock_obj () const |
Unlock this thread object. More... | |
virtual void | impl_interrupt () |
Send an 'interrupt' event to the platform-specific thread implementation. More... | |
virtual const bool | impl_join (const long msec) |
Wait for the platform thread to terminate. More... | |
virtual void | impl_sleep (const long msec) |
Put the current thread to sleep. More... | |
Runnable * | getTarget () const |
Get a reference to the user-supplied execution object. More... | |
const State | setState (State, const bool lockit=true) |
Set the state of the thread. More... | |
void | setError (const char *e) const |
Set the error string that describes the most recent error. More... | |
const std::string & | getError () const |
Get the an explanation of the last error that occurred (if any). More... | |
const Priority | getPriority () const |
Get the thread's scheduling priority. More... | |
Static Protected Methods | |
void * | run_thread (void *) |
Private Methods | |
const long | getTid () const |
|
Thread scheduling priorities.
|
|
Thread states.
|
|
|
|
|
|
Factory method for creating thread objects.
|
|
|
|
Get reference to the current thread of execution.
|
|
Retrieve user data that has been associated with this thread (if any).
|
|
Get the an explanation of the last error that occurred (if any). This method is only available to the implementation-specific derived class.
|
|
Get the thread's scheduling priority. This method is only available to the implementation-specific derived class.
|
|
Get this thread's run state.
|
|
Get a reference to the user-supplied execution object.
|
|
Get Thread's ID.
|
|
|
|
Create a platform-specific thread. This method must be implemented by the platform-specific derived class.
Implements cbits::Thread. |
|
Get thread's ID. This method is called internally to prevent access to the thread object while it is modifying its internal state.
Implements cbits::Thread. |
|
Send an 'interrupt' event to the platform-specific thread implementation. This method must be implemented by the platform-specific derived class. Implements cbits::Thread. |
|
Wait for the platform thread to terminate. This method must be implemented by the platform-specific derived class.
Implements cbits::Thread. |
|
Lock this thread object. This method is called internally to prevent access to the thread object while it is modifying its internal state. This method must be implemented by the platform-specific derived class. Implements cbits::Thread. |
|
Put the current thread to sleep. This method must be implemented by the platform-specific derived class. Implements cbits::Thread. |
|
Start the platform-specific thread. This method must be implemented by the platform-specific derived class.
Implements cbits::Thread. |
|
Unlock this thread object. This method is called internally to release the lock that may have been set to prevent access to the thread object while it is modifying its internal state. This method must be implemented by the platform-specific derived class. Implements cbits::Thread. |
|
Send a event to the thread. It is intended that the Runnable code must be written in such a way that it is sensitive to the interrupt status of the thread. It may check the interrupt status by calling the 'isInterrupted' method. |
|
Check the interrupt status of the current thread. The interrupt state is reset after every call to this method.
|
|
Wait for this thread to terminate. FIXME Thread.h 'msec' argument is ignored by 'join' method.
|
|
|
|
Associate user data with this thread.
|
|
Set the error string that describes the most recent error. This method is only available to the implementation-specific derived class.
|
|
Set the state of the thread. This method is only available to the implementation specific derived class.
|
|
Put current thread to sleep.
|
|
Start the thread. The Thread object's state changes from READY to ALIVE. @raises ThreadException if :
|
|
Give up the processor. If no other threads are eligible to execute, the thread that yielded will be immediately rescheduled. Reimplemented from cbits::Thread. |
|
|