Ticket #5554: xplthread.patch
File xplthread.patch, 2.2 KB (added by joe@…, 19 years ago) |
---|
-
hula/include/xplthread.h
201 201 202 202 203 203 #ifdef HAVE_SEMAPHORE_H 204 204 205 /* Semaphores */ 205 206 /********************** 206 207 Semaphores 207 208 **********************/ 208 #define XplSemaphore sem_t 209 210 #ifdef MACOSX 211 212 #include <Multiprocessing.h> 213 #include <MacErrors.h> 214 215 #define XplSemaphore MPSemaphoreID 216 #define XplOpenLocalSemaphore(sem, init) (MPCreateSemaphore(0x7fffffff,init,&sem) != noErr ? -1 : (int) sem) 217 #define XplCloseLocalSemaphore(sem) (MPDeleteSemaphore(sem) != noErr ? -1 : 0) 218 #define XplWaitOnLocalSemaphore(sem) (MPWaitOnSemaphore(sem,kDurationForever) != noErr ? -1 : 0) 219 #define XplSignalLocalSemaphore(sem) (MPSignalSemaphore(sem) != noErr ? -1 : 0) 220 #define XplExamineLocalSemaphore(sem, cnt) if (MPWaitOnSemaphore(sem,kDurationImmediate) != kMPTimeoutErr) { MPSignalSemaphore(sem); cnt = 1; } else { cnt = 0; } 221 222 #else 223 224 #define XplSemaphore sem_t 209 225 #define XplOpenLocalSemaphore(sem, init) sem_init(&sem, 0, init) 210 #define XplCloseLocalSemaphore(sem) 226 #define XplCloseLocalSemaphore(sem) sem_destroy(&sem) 211 227 #define XplWaitOnLocalSemaphore(sem) sem_wait(&sem) 212 228 #define XplSignalLocalSemaphore(sem) sem_post(&sem) 213 #define XplExamineLocalSemaphore(sem, cnt) sem_getvalue(&sem, (int *)&cnt)229 #define XplExamineLocalSemaphore(sem, cnt) sem_getvalue(&sem, (int *)&cnt) 214 230 231 #endif 232 215 233 #elif defined(WIN32) 216 234 217 235 #define XplSemaphore HANDLE -
hula/configure.in
301 301 PTHREAD_LIBS="-pthread -lc_r" 302 302 fi 303 303 ;; 304 *darwin*) 305 #As of 10.4.2, POSIX Unnamed Semaphores are not implemented, use Carbon Semaphores instead 306 PTHREAD_LIBS="-lpthread -framework Carbon" 307 PTHREAD_CFLAGS="-I/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers" 308 CFLAGS="$CFLAGS -DMACOSX" 309 ;; 304 310 esac 305 311 AC_MSG_CHECKING(pthread cflags) 306 312 AC_MSG_RESULT($PTHREAD_CFLAGS)