39#ifndef BLOCXX_THREADIMPL_HPP_INCLUDE_GUARD_
40#define BLOCXX_THREADIMPL_HPP_INCLUDE_GUARD_
41#include "blocxx/BLOCXX_config.h"
47#ifndef PTHREAD_ONCE_INIT
48#define PTHREAD_ONCE_INIT pthread_once_init
62#define BLOCXX_THREAD_FLG_JOINABLE 0x000000001
84 void* funcParm, UInt32 threadFlags);
98 const volatile Thread_t& handle2)
100 #if defined(BLOCXX_WIN32)
101 return handle1 == handle2;
102 #elif BLOCXX_USE_PTHREAD
103 return pthread_equal(handle1, handle2);
113 BLOCXX_COMMON_API
void exitThread(Thread_t& handle, Int32 rval);
119#if defined(BLOCXX_WIN32)
120 return GetCurrentThreadId();
122 return pthread_self();
154 BLOCXX_COMMON_API
int joinThread(Thread_t& handle, Int32& rval);
159 BLOCXX_COMMON_API
void yield();
165 BLOCXX_COMMON_API
void sleep(UInt32 milliSeconds);
202 BLOCXX_COMMON_API
void cancel(Thread_t threadID);
A timeout can be absolute, which means that it will happen at the specified DateTime.
The ThreadImpl namespace represents the functionality needed by the BloCxx Thread class (Thread).
BLOCXX_COMMON_API void testCancel()
Test if this thread has been cancelled.
BLOCXX_COMMON_API void destroyThread(Thread_t &handle)
Destroy any resources associated with a thread that was created with the createThread method.
BLOCXX_COMMON_API int joinThread(Thread_t &handle, Int32 &rval)
Join a thread that has been previously set to joinable.
bool sameThreads(const volatile Thread_t &handle1, const volatile Thread_t &handle2)
Check two platform dependant thread types for equality.
BLOCXX_COMMON_API UInt64 thread_t_ToUInt64(Thread_t thr)
Convert a Thread_t to an UInt64.
BLOCXX_COMMON_API int createThread(Thread_t &handle, ThreadFunction func, void *funcParm, UInt32 threadFlags)
Starts a thread running the given function.
BLOCXX_COMMON_API int setThreadDetached(Thread_t &handle)
Set a thread that was previously in the joinable state to a detached state.
BLOCXX_COMMON_API void cancel(Thread_t threadID)
void yield()
Voluntarily yield to the processor giving the next thread in the chain the opportunity to run.
void sleep(UInt32 milliSeconds)
Suspend execution of the current thread until the given number of milliSeconds have elapsed.
BLOCXX_COMMON_API void exitThread(Thread_t &handle, Int32 rval)
Exit thread method.
BLOCXX_COMMON_API void saveThreadInTLS(void *pTheThread)
BLOCXX_COMMON_API void sendSignalToThread(Thread_t threadID, int signo)
Int32(* ThreadFunction)(void *)