Mercurial > projects > ldc
comparison druntime/import/core/sys/osx/mach/semaphore.d @ 1458:e0b2d67cfe7c
Added druntime (this should be removed once it works).
author | Robert Clipsham <robert@octarineparrot.com> |
---|---|
date | Tue, 02 Jun 2009 17:43:06 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1456:7b218ec1044f | 1458:e0b2d67cfe7c |
---|---|
1 /** | |
2 * D header file for OSX. | |
3 * | |
4 * Copyright: Copyright Sean Kelly 2008 - 2009. | |
5 * License: <a href="http://www.boost.org/LICENSE_1_0.txt>Boost License 1.0</a>. | |
6 * Authors: Sean Kelly | |
7 * | |
8 * Copyright Sean Kelly 2008 - 2009. | |
9 * Distributed under the Boost Software License, Version 1.0. | |
10 * (See accompanying file LICENSE_1_0.txt or copy at | |
11 * http://www.boost.org/LICENSE_1_0.txt) | |
12 */ | |
13 module core.sys.osx.mach.semaphore; | |
14 | |
15 public import core.sys.osx.mach.kern_return; | |
16 public import core.sys.osx.mach.port; | |
17 | |
18 extern (C): | |
19 | |
20 alias mach_port_t task_t; | |
21 alias mach_port_t thread_t; | |
22 alias mach_port_t semaphore_t; | |
23 alias int sync_policy_t; | |
24 | |
25 alias int clock_res_t; | |
26 struct mach_timespec_t | |
27 { | |
28 uint tv_sec; | |
29 clock_res_t tv_nsec; | |
30 } | |
31 | |
32 enum | |
33 { | |
34 SYNC_POLICY_FIFO = 0x0, | |
35 SYNC_POLICY_FIXED_PRIORITY = 0x1, | |
36 SYNC_POLICY_REVERSED = 0x2, | |
37 SYNC_POLICY_ORDER_MASK = 0x3, | |
38 SYNC_POLICY_LIFO = (SYNC_POLICY_FIFO | SYNC_POLICY_REVERSED), | |
39 SYNC_POLICY_MAX = 0x7, | |
40 } | |
41 | |
42 task_t mach_task_self(); | |
43 kern_return_t semaphore_create(task_t, semaphore_t*, int, int); | |
44 kern_return_t semaphore_destroy(task_t, semaphore_t); | |
45 | |
46 kern_return_t semaphore_signal(semaphore_t); | |
47 kern_return_t semaphore_signal_all(semaphore_t); | |
48 kern_return_t semaphore_signal_thread(semaphore_t, thread_t); | |
49 | |
50 kern_return_t semaphore_wait(semaphore_t); | |
51 kern_return_t semaphore_wait_signal(semaphore_t, semaphore_t); | |
52 | |
53 kern_return_t semaphore_timedwait(semaphore_t, mach_timespec_t); | |
54 kern_return_t semaphore_timedwait_signal(semaphore_t, semaphore_t, mach_timespec_t); |