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