#include <Thread.hpp>
Inheritance diagram for corelinux::Thread:
Public Member Functions | |
Thread (void) throw ( Assertion ) | |
Default constructor. | |
virtual | ~Thread (void) |
Virtual destructor. | |
Static Public Member Functions | |
static Int | getKernelError (void) |
getKernelError returns the thread instance errno for the last kernel call the thread made | |
static ThreadIdentifier | getThreadIdentifier (void) |
getThreadIdentifier retrieves the kernel process id for the caller thread | |
static ThreadIdentifier | getParentThreadIdentifier (void) |
getParentThreadIdentifier retrieves the parent thread of the current thread. | |
static ThreadIdentifierCref | getThreadManagerIdentifier (void) |
getThreadManagerIdentifier retrieves the thread that Thread was instantiated from | |
static ThreadContextCref | getThreadContext (ThreadIdentifierCref) throw ( InvalidThreadException ) |
Retrieve a ThreadContext given a identifier. | |
static Count | getCreatedThreadCount (void) |
Retrieve the number of created threads. | |
static Count | getActiveThreadCount (void) |
Retrieve the number of threads that are starting or running. | |
static Count | getBlockedThreadCount (void) |
Retrieve the number of threads that are waiting ro tun. | |
static Count | getCompletedThreadCount (void) |
Retrieve the number of threads that are not starting or running or waiting to run. | |
static void | dump (void) |
Debugging method for the moment. | |
static ThreadIdentifier | startThread (ThreadContextRef) |
Start a thread as described by the context. | |
static Int | waitForThread (ThreadIdentifierCref) throw ( InvalidThreadException ) |
Blocks the caller until the thread has ended execution, retrieving the return code from the associated thread context. | |
static void | destroyThreadContext (ThreadIdentifierCref) throw ( InvalidThreadException, Assertion ) |
Destroys the managed context for the given identifier. | |
static Int | getThreadPriority (ThreadIdentifierCref) throw ( InvalidThreadException, Assertion ) |
Get thread priority for the given indentifier. | |
static void | setThreadPriority (ThreadIdentifierCref, Int) throw ( InvalidThreadException, Assertion ) |
Set thread priority for the given indentifier. | |
Protected Member Functions | |
Thread (ThreadCref) throw ( Assertion ) | |
Copy constructor won't do, its a singleton. | |
ThreadRef | operator= (ThreadCref) throw ( Assertion ) |
Assignment operator won't do, we should never get here anyway but the compiler will generate the missing method. | |
bool | operator== (ThreadCref) const throw ( Assertion ) |
Equality operator not valid for class utility. | |
Static Protected Member Functions | |
static void | threadTerminated (Int, VoidPtr, VoidPtr) |
Static Protected Attributes | |
static ThreadManager | theThreadManager |
The singleton instance of Thread for synchronization. |
It accomplishes this by allowing the caller to setup a context for execution and calling their defined entry point. There is still much work to be done such as:
corelinux::Thread::Thread | ( | ThreadCref | ) | throw ( Assertion ) [protected] |
Int corelinux::Thread::getKernelError | ( | void | ) | [static] |
getKernelError returns the thread instance errno for the last kernel call the thread made
ThreadIdentifier corelinux::Thread::getThreadIdentifier | ( | void | ) | [static] |
getThreadIdentifier retrieves the kernel process id for the caller thread
ThreadIdentifier corelinux::Thread::getParentThreadIdentifier | ( | void | ) | [static] |
getParentThreadIdentifier retrieves the parent thread of the current thread.
ThreadIdentifierCref corelinux::Thread::getThreadManagerIdentifier | ( | void | ) | [static] |
getThreadManagerIdentifier retrieves the thread that Thread was instantiated from
ThreadContextCref corelinux::Thread::getThreadContext | ( | ThreadIdentifierCref | ) | throw ( InvalidThreadException ) [static] |
Retrieve a ThreadContext given a identifier.
ThreadIdentifier | unique id |
InvalidThreadException | if it does not exist. |
Count corelinux::Thread::getCreatedThreadCount | ( | void | ) | [static] |
Retrieve the number of created threads.
Count corelinux::Thread::getActiveThreadCount | ( | void | ) | [static] |
Retrieve the number of threads that are starting or running.
Count corelinux::Thread::getBlockedThreadCount | ( | void | ) | [static] |
Retrieve the number of threads that are waiting ro tun.
Count corelinux::Thread::getCompletedThreadCount | ( | void | ) | [static] |
Retrieve the number of threads that are not starting or running or waiting to run.
ThreadIdentifier corelinux::Thread::startThread | ( | ThreadContextRef | ) | [static] |
Start a thread as described by the context.
ThreadContext | reference to thread context object. This object is copied into a managed context. |
Int corelinux::Thread::waitForThread | ( | ThreadIdentifierCref | ) | throw ( InvalidThreadException ) [static] |
Blocks the caller until the thread has ended execution, retrieving the return code from the associated thread context.
ThreadIdentifier | unique thread id |
InvalidThreadException | if not a valid thread identifier. |
void corelinux::Thread::destroyThreadContext | ( | ThreadIdentifierCref | ) | throw ( InvalidThreadException, Assertion ) [static] |
Destroys the managed context for the given identifier.
ThreadIdentifier | unique thread id |
InvalidThreadException | if the thread id is not one in the managed store. | |
Assertion | if the thread is in a running state. |
Int corelinux::Thread::getThreadPriority | ( | ThreadIdentifierCref | ) | throw ( InvalidThreadException, Assertion ) [static] |
Get thread priority for the given indentifier.
ThreadIdentifier | unique thread id |
InvalidThreadException | if the thread id is not one in the managed store. | |
Assertion | if the thread is in a running state. |
void corelinux::Thread::setThreadPriority | ( | ThreadIdentifierCref | , | |
Int | ||||
) | throw ( InvalidThreadException, Assertion ) [static] |
Set thread priority for the given indentifier.
ThreadIdentifier | unique thread id | |
prio | priority value |
InvalidThreadException | if the thread id is not one in the managed store. | |
Assertion | if the thread is in a running state. |
ThreadRef corelinux::Thread::operator= | ( | ThreadCref | ) | throw ( Assertion ) [protected] |
bool corelinux::Thread::operator== | ( | ThreadCref | ) | const throw ( Assertion ) [protected] |