ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/semaphore.h
(Generate patch)

Comparing BasiliskII/src/Unix/semaphore.h (file contents):
Revision 1.1.1.1 by cebix, 1999-10-03T14:16:25Z vs.
Revision 1.2 by gbeauche, 2005-05-14T17:32:55Z

# Line 7 | Line 7
7   extern "C" {
8   #endif /* c_plusplus || __cplusplus */
9  
10 + /* MacOS X doesn't implement unnamed POSIX semaphores, event though
11 +   the libc defines them! */
12 + #if (defined(__MACH__) && defined(__APPLE__))
13 + #include <mach/mach_init.h>
14 + #include <mach/task.h>
15 + #include <mach/semaphore.h>
16 +
17 + #define sem_t                                           semaphore_t
18 + #define sem_init(SEM,UNUSED,VALUE)      semaphore_create(current_task(), (SEM), SYNC_POLICY_FIFO, (VALUE))
19 + #define sem_destroy(SEM)                        semaphore_destroy(current_task(), *(SEM))
20 + #define sem_wait(SEM)                           semaphore_wait(*(SEM))
21 + #define sem_post(SEM)                           semaphore_signal(*(SEM))
22 + #else
23   typedef struct psem {
24          pthread_mutex_t sem_lock;
25          int sem_value;
# Line 22 | Line 35 | int sem_wait(sem_t* sem);
35   int sem_trywait(sem_t* sem);
36   int sem_post(sem_t* sem);
37   int sem_getvalue(sem_t* sem, int* sval);
38 + #endif
39  
40   #if defined(c_plusplus) || defined(__cplusplus)
41   };

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines