Functions | |
void | sleep (UInt32 milliSeconds) |
Suspend execution of the current thread until the given number of milliSeconds have elapsed. | |
void | yield () |
Voluntarily yield to the processor giving the next thread in the chain the opportunity to run. | |
static void * | threadStarter (void *arg) |
static void | initializeTheKey () |
int | createThread (Thread_t &handle, ThreadFunction func, void *funcParm, UInt32 threadFlags) |
Starts a thread running the given function. | |
void | exitThread (Thread_t &handle, Int32 rval) |
Exit thread method. | |
UInt64 | thread_t_ToUInt64 (Thread_t thr) |
Convert a Thread_t to an UInt64. | |
void | destroyThread (Thread_t &handle) |
Destroy any resources associated with a thread that was created with the createThread method. | |
int | setThreadDetached (Thread_t &handle) |
Set a thread that was previously in the joinable state to a detached state. | |
int | joinThread (Thread_t &handle, Int32 &rval) |
Join a thread that has been previously set to joinable. | |
void | testCancel () |
Test if this thread has been cancelled. | |
void | saveThreadInTLS (void *pTheThread) |
void | sendSignalToThread (Thread_t threadID, int signo) |
void | cancel (Thread_t threadID) |
bool | sameThreads (const volatile Thread_t &handle1, const volatile Thread_t &handle2) |
Check two platform dependant thread types for equality. | |
Thread_t | currentThread () |
void | memoryBarrier () |
Deprecated because no code should need to use this, and if some does it should be rewritten to use the other thread primitives. | |
Variables | |
default_stack_size | g_theDefaultStackSize |
pthread_once_t | once_control = PTHREAD_ONCE_INIT |
pthread_key_t | theKey |
It also contains other misellaneous functions which are useful for synchronization and threads. It is essentially an abstraction layer over a thread implementation.
|
Definition at line 386 of file OW_ThreadImpl.cpp. References OW_THROW. Referenced by OW_NAMESPACE::Thread::cancel(). |
|
Starts a thread running the given function.
Definition at line 247 of file OW_ThreadImpl.cpp. References needsSetting, OW_THREAD_FLG_JOINABLE, threadStarter(), and val. Referenced by OW_NAMESPACE::Thread::start(). |
|
Definition at line 106 of file OW_ThreadImpl.hpp. Referenced by OW_NAMESPACE::RWLocker::getReadLock(), OW_NAMESPACE::RWLocker::getWriteLock(), and OW_NAMESPACE::RWLocker::releaseReadLock(). |
|
Destroy any resources associated with a thread that was created with the createThread method.
Definition at line 309 of file OW_ThreadImpl.cpp. Referenced by OW_NAMESPACE::Thread::~Thread(). |
|
Exit thread method. This method is called everytime a thread exits. When the POSIX threads are being used, pthread_exit is called. This function does not return.
Definition at line 279 of file OW_ThreadImpl.cpp. Referenced by OW_NAMESPACE::Thread::threadRunner(). |
|
Definition at line 227 of file OW_ThreadImpl.cpp. References theKey. Referenced by saveThreadInTLS(), CMPI_ThreadContext::setContext(), and testCancel(). |
|
Join a thread that has been previously set to joinable. It is Assumed that if the thread has already terminated, this method will still succeed and return immediately.
Definition at line 330 of file OW_ThreadImpl.cpp. Referenced by OW_NAMESPACE::Thread::join(). |
|
Deprecated because no code should need to use this, and if some does it should be rewritten to use the other thread primitives.
Definition at line 158 of file OW_ThreadImpl.hpp. |
|
Check two platform dependant thread types for equality.
Definition at line 86 of file OW_ThreadImpl.hpp. Referenced by OW_NAMESPACE::RWLocker::getReadLock(), OW_NAMESPACE::RWLocker::getWriteLock(), OW_NAMESPACE::RWLocker::releaseReadLock(), and OW_NAMESPACE::sameId(). |
|
Definition at line 366 of file OW_ThreadImpl.cpp. References initializeTheKey(), once_control, OW_THROW, and theKey. Referenced by OW_NAMESPACE::Thread::threadRunner(). |
|
Definition at line 377 of file OW_ThreadImpl.cpp. References OW_THROW. Referenced by OW_NAMESPACE::Thread::cooperativeCancel(), and OW_NAMESPACE::Thread::definitiveCancel(). |
|
Set a thread that was previously in the joinable state to a detached state. This will allow the threads resources to be released upon termination without being joined. A thread that is in the detached state can no longer be joined.
Definition at line 315 of file OW_ThreadImpl.cpp. |
|
Suspend execution of the current thread until the given number of milliSeconds have elapsed.
Definition at line 82 of file OW_ThreadImpl.cpp. References OW_NAMESPACE::Select::select(), and testCancel(). Referenced by mbExtThreadSleep(), OW_NAMESPACE::milliSleep(), OW_NAMESPACE::secSleep(), OW_NAMESPACE::OpenWBEM_ObjectManagerInstProv::shuttingDown(), OW_NAMESPACE::Thread::sleep(), and yield(). |
|
Test if this thread has been cancelled. If so, a ThreadCancelledException will be thrown. DO NOT catch this exception. ThreadCancelledException is not derived from anything. Do not write code like this: try { //... } catch (...) { // swallow all exceptions } Instead do this: try { //... } catch (ThreadCancelledException&) { throw; } catch (std::exception& e) { // handle the exception } The only place ThreadCancelledException should be caught is in Thread::threadRunner(). main() shouldn't need to catch it, as the main thread of an application should never be cancelled. The main thread shouldn't need to ever call testCancel. Note that this method is staic, and it will check the the current running thread has been cacelled. Thus, you can't call it on an object that doesn't represent the current running thread and expect it to work. Definition at line 345 of file OW_ThreadImpl.cpp. References initializeTheKey(), OW_NAMESPACE::Thread::m_cancelLock, OW_NAMESPACE::Thread::m_cancelRequested, once_control, and theKey. Referenced by OW_NAMESPACE::noIntrWaitPid(), OW_NAMESPACE::Select::selectRWPoll(), OW_NAMESPACE::Select::selectRWSelect(), sleep(), OW_NAMESPACE::Thread::testCancel(), and yield(). |
|
Convert a Thread_t to an UInt64. This hides platform dependencies like that fact that on some platforms (e.g linux) Thread_t is integral type, and can therefor be static_cast<>ed to unsigned long, but on other platforms, like FreeBSD, Thread_t is void*, or something else, and reinterpret_cast<> (hopefully that works ...) must be used. Definition at line 300 of file OW_ThreadImpl.cpp. References OW_THREAD_CONVERTER. |
|
Definition at line 152 of file OW_ThreadImpl.cpp. References OW_ASSERT. Referenced by createThread(). |
|
Voluntarily yield to the processor giving the next thread in the chain the opportunity to run.
Definition at line 131 of file OW_ThreadImpl.cpp. References sleep(), and testCancel(). Referenced by OW_NAMESPACE::Thread::yield(). |
|
Definition at line 221 of file OW_ThreadImpl.cpp. |
|
Definition at line 223 of file OW_ThreadImpl.cpp. Referenced by CMPI_ThreadContext::getThreadContext(), saveThreadInTLS(), CMPI_ThreadContext::setContext(), and testCancel(). |
|