Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

osx_compatibility.h

Go to the documentation of this file.
00001 #ifdef MACOSX
00002 
00003 /*******************************************************************
00004  * This is a bad hack, since a mutex is owned by the locker,
00005  * while a semaphore not. So we use a passing le baton technique
00006  * with mutex. This seems to work on macosx that lacks 
00007  * semaphore implementation. But is not semantically correct.
00008  *******************************************************************/ 
00009 
00010 #define sem_t pthread_mutex_t
00011 #define sem_wait(s) pthread_mutex_lock(s)
00012 #define sem_post(s) pthread_mutex_unlock(s)
00013 #define sem_init(s,a,b) (__extension__(\
00014         {\
00015         pthread_mutex_t __tmp = PTHREAD_MUTEX_INITIALIZER;\
00016         *(s) = __tmp;\
00017         if((b) == 0)\
00018                 pthread_mutex_lock(s);\
00019         if((b) > 1 || (b) < 0 )\
00020                 abort();\
00021         0;\
00022         }\
00023 ))
00024 #define sem_destroy(s) pthread_mutex_destroy(s)
00025 
00026 #define snprintf(a,b,c...) (__extension__                       \
00027                         ({                                      \
00028                         int __result;                           \
00029                         if ( a == NULL && b == 0)               \
00030                                 __result = c99_snprintf(c);     \
00031                         else                                    \
00032                                 __result = snprintf(a,b,c);     \
00033                         __result; }))
00034 
00035 #define vsnprintf(a,b,c,d) (__extension__                       \
00036                         ({                                      \
00037                         int __result;                           \
00038                         if ( a == NULL && b == 0)               \
00039                                 __result = c99_vsnprintf(c,d);\
00040                         else                                    \
00041                                 __result = vsnprintf(a,b,c,d);  \
00042                         __result; }))
00043 
00044 #endif

Generated on Wed May 5 15:48:03 2004 for LiberoPOPs by doxygen 1.3.6-20040222