comparison tango/tango/stdc/posix/semaphore.d @ 132:1700239cab2e trunk

[svn r136] MAJOR UNSTABLE UPDATE!!! Initial commit after moving to Tango instead of Phobos. Lots of bugfixes... This build is not suitable for most things.
author lindquist
date Fri, 11 Jan 2008 17:57:40 +0100
parents
children
comparison
equal deleted inserted replaced
131:5825d48b27d1 132:1700239cab2e
1 /**
2 * D header file for POSIX.
3 *
4 * Copyright: Public Domain
5 * License: Public Domain
6 * Authors: Sean Kelly
7 * Standards: The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition
8 */
9 module tango.stdc.posix.semaphore;
10
11 private import tango.stdc.posix.config;
12 private import tango.stdc.posix.time;
13
14 extern (C):
15
16 //
17 // Required
18 //
19 /*
20 sem_t
21 SEM_FAILED
22
23 int sem_close(sem_t*);
24 int sem_destroy(sem_t*);
25 int sem_getvalue(sem_t*, int*);
26 int sem_init(sem_t*, int, uint);
27 sem_t* sem_open(char*, int, ...);
28 int sem_post(sem_t*);
29 int sem_trywait(sem_t*);
30 int sem_unlink(char*);
31 int sem_wait(sem_t*);
32 */
33
34 version( linux )
35 {
36 private alias int __atomic_lock_t;
37
38 private struct _pthread_fastlock
39 {
40 c_long __status;
41 __atomic_lock_t __spinlock;
42 }
43
44 struct sem_t
45 {
46 _pthread_fastlock __sem_lock;
47 int __sem_value;
48 void* __sem_waiting;
49 }
50
51 const SEM_FAILED = cast(sem_t*) null;
52 }
53 else version( darwin )
54 {
55 alias int sem_t;
56
57 const SEM_FAILED = cast(sem_t*) null;
58 }
59
60 int sem_close(sem_t*);
61 int sem_destroy(sem_t*);
62 int sem_getvalue(sem_t*, int*);
63 int sem_init(sem_t*, int, uint);
64 sem_t* sem_open(char*, int, ...);
65 int sem_post(sem_t*);
66 int sem_trywait(sem_t*);
67 int sem_unlink(char*);
68 int sem_wait(sem_t*);
69
70 //
71 // Timeouts (TMO)
72 //
73 /*
74 int sem_timedwait(sem_t*, timespec*);
75 */
76
77 version( linux )
78 {
79 int sem_timedwait(sem_t*, timespec*);
80 }
81 else version( darwin )
82 {
83 int sem_timedwait(sem_t*, timespec*);
84 }