~ubuntu-branches/ubuntu/vivid/basilisk2/vivid

« back to all changes in this revision

Viewing changes to src/Unix/semaphore.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2008-03-06 19:33:01 UTC
  • mfrom: (2.1.4 gutsy)
  • Revision ID: james.westby@ubuntu.com-20080306193301-cc2ofn705nfsq3y0
Tags: 0.9.20070407-4
* Update copyright-check cdbs snippet to parse licensecheck using perl:
  + No longer randomly drops newlines
  + More compact hint file (and ordered more like wiki-proposed new copyright
    syntax).
  + No longer ignore files without copyright.
* Update copyright_hints.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
extern "C" {
8
8
#endif /* c_plusplus || __cplusplus */
9
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
10
23
typedef struct psem {
11
24
        pthread_mutex_t sem_lock;
12
25
        int sem_value;
22
35
int sem_trywait(sem_t* sem);
23
36
int sem_post(sem_t* sem);
24
37
int sem_getvalue(sem_t* sem, int* sval);
 
38
#endif
25
39
 
26
40
#if defined(c_plusplus) || defined(__cplusplus)
27
41
};