Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef __omnithread_nt_h_
00028 #define __omnithread_nt_h_
00029
00030 #ifndef WIN32_LEAN_AND_MEAN
00031 # define WIN32_LEAN_AND_MEAN
00032 # define OMNI_DEFINED_WIN32_LEAN_AND_MEAN
00033 #endif
00034
00035 #include <windows.h>
00036
00037 #ifdef OMNI_DEFINED_WIN32_LEAN_AND_MEAN
00038 # undef WIN32_LEAN_AND_MEAN
00039 # undef OMNI_DEFINED_WIN32_LEAN_AND_MEAN
00040 #endif
00041
00042
00043 #ifndef __BCPLUSPLUS__
00044 #define OMNI_THREAD_WRAPPER \
00045 unsigned __stdcall omni_thread_wrapper(LPVOID ptr);
00046 #else
00047 #define OMNI_THREAD_WRAPPER \
00048 void _USERENTRY omni_thread_wrapper(void *ptr);
00049 #endif
00050
00051 extern "C" OMNI_THREAD_WRAPPER;
00052
00053 #define OMNI_MUTEX_IMPLEMENTATION \
00054 CRITICAL_SECTION crit;
00055
00056 #define OMNI_MUTEX_LOCK_IMPLEMENTATION \
00057 EnterCriticalSection(&crit);
00058
00059 #define OMNI_MUTEX_TRYLOCK_IMPLEMENTATION \
00060 TryEnterCriticalSection(&crit);
00061
00062 #define OMNI_MUTEX_UNLOCK_IMPLEMENTATION \
00063 LeaveCriticalSection(&crit);
00064
00065 #define OMNI_CONDITION_IMPLEMENTATION \
00066 CRITICAL_SECTION crit; \
00067 omni_thread* waiting_head; \
00068 omni_thread* waiting_tail;
00069
00070 #define OMNI_SEMAPHORE_IMPLEMENTATION \
00071 HANDLE nt_sem;
00072
00073 #define OMNI_THREAD_IMPLEMENTATION \
00074 HANDLE handle; \
00075 DWORD nt_id; \
00076 void* return_val; \
00077 HANDLE cond_semaphore; \
00078 omni_thread* cond_next; \
00079 omni_thread* cond_prev; \
00080 BOOL cond_waiting; \
00081 static int nt_priority(priority_t); \
00082 friend class omni_condition; \
00083 friend OMNI_THREAD_WRAPPER;
00084
00085 #endif