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
00028 #ifndef __omnithread_posix_h_
00029 #define __omnithread_posix_h_
00030
00031 #if defined(__alpha__) && defined(__osf1__) || defined(__hpux__)
00032
00033 #ifndef EXC_HANDLING
00034 #define EXC_HANDLING
00035 #endif
00036 #endif
00037
00038 #ifndef __POSIX_NT__
00039 # include <pthread.h>
00040 #else
00041 # ifndef WIN32_LEAN_AND_MEAN
00042 # define WIN32_LEAN_AND_MEAN
00043 # define OMNI_DEFINED_WIN32_LEAN_AND_MEAN
00044 # endif
00045 # include <windows.h>
00046 # include "pthread_nt.h"
00047 # ifdef OMNI_DEFINED_WIN32_LEAN_AND_MEAN
00048 # undef WIN32_LEAN_AND_MEAN
00049 # undef OMNI_DEFINED_WIN32_LEAN_AND_MEAN
00050 # endif
00051 #endif
00052
00053 extern "C" void* omni_thread_wrapper(void* ptr);
00054
00055 #define OMNI_MUTEX_IMPLEMENTATION \
00056 pthread_mutex_t posix_mutex;
00057
00058 #define OMNI_MUTEX_LOCK_IMPLEMENTATION \
00059 pthread_mutex_lock(&posix_mutex);
00060
00061 #define OMNI_MUTEX_TRYLOCK_IMPLEMENTATION \
00062 (pthread_mutex_trylock(&posix_mutex)==0);
00063
00064 #define OMNI_MUTEX_UNLOCK_IMPLEMENTATION \
00065 pthread_mutex_unlock(&posix_mutex);
00066
00067 #define OMNI_CONDITION_IMPLEMENTATION \
00068 pthread_cond_t posix_cond;
00069
00070 #define OMNI_SEMAPHORE_IMPLEMENTATION \
00071 omni_mutex m; \
00072 omni_condition c; \
00073 int value; \
00074 int max_count;
00075
00076 #define OMNI_THREAD_IMPLEMENTATION \
00077 pthread_t posix_thread; \
00078 static int posix_priority(priority_t); \
00079 friend void* omni_thread_wrapper(void* ptr);
00080
00081 #endif