version 1.20, 2008/12/02 09:00:53
|
version 1.20.8.1, 2013/06/03 22:35:14
|
|
|
| |
static void exit(ThreadReturnType rc); | static void exit(ThreadReturnType rc); |
| |
static void cancel(ThreadType th, ThreadReturnType rc); |
|
|
|
static void yield(); | static void yield(); |
| |
static void sleep(int msec); | static void sleep(int msec); |
| |
static void cleanup_push(void (*start)(void*), void* arg); |
|
|
|
static void cleanup_pop(int execute); |
|
|
|
static ThreadId id(const ThreadType& x = Threads::self()); | static ThreadId id(const ThreadType& x = Threads::self()); |
| |
static bool null(const ThreadType& x = Threads::self()); | static bool null(const ThreadType& x = Threads::self()); |
|
|
pthread_exit(rc); | pthread_exit(rc); |
} | } |
| |
inline void Threads::cancel(ThreadType th, ThreadReturnType rc) |
|
{ |
|
pthread_cancel(th.thread); |
|
} |
|
|
|
inline void Threads::yield() | inline void Threads::yield() |
{ | { |
#ifdef PEGASUS_OS_LINUX | #ifdef PEGASUS_OS_LINUX |
|
|
#endif | #endif |
} | } |
| |
inline void Threads::cleanup_push(void (*func)(void*), void* arg) |
|
{ |
|
// ATTN: it is doubtful whether cleanup handlers ever really worked. |
|
// They are only used in two places and not used in many other |
|
// places where mutexes are obtained. Further, they are only |
|
// implemented correctly on one or two platforms. For now, we |
|
// will defer their implementation until we can find a way to |
|
// implement them on all platforms (using thread local storage). |
|
} |
|
|
|
inline void Threads::cleanup_pop(int execute) |
|
{ |
|
// ATTN: not implemented. |
|
} |
|
|
|
inline ThreadId Threads::id(const ThreadType& x) | inline ThreadId Threads::id(const ThreadType& x) |
{ | { |
ThreadId tid = { { 0 } }; | ThreadId tid = { { 0 } }; |
|
|
_endthreadex(rc); | _endthreadex(rc); |
} | } |
| |
inline void Threads::cancel(ThreadType th, ThreadReturnType rc) |
|
{ |
|
TerminateThread(th.handle, rc); |
|
} |
|
|
|
inline void Threads::yield() | inline void Threads::yield() |
{ | { |
Sleep(0); | Sleep(0); |
} | } |
| |
inline void Threads::cleanup_push(void (*func)(void*), void* arg) |
|
{ |
|
// ATTN: Not implemented on Windows. |
|
} |
|
|
|
inline void Threads::cleanup_pop(int execute) |
|
{ |
|
// ATTN: Not implemented on Windows. |
|
} |
|
|
|
inline ThreadId Threads::id(const ThreadType& x) | inline ThreadId Threads::id(const ThreadType& x) |
{ | { |
ThreadId tmp; | ThreadId tmp; |