PageRenderTime 18ms CodeModel.GetById 10ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/src/core/sys/osx/mach/semaphore.d

http://github.com/AlexeyProkhin/druntime
D | 56 lines | 34 code | 10 blank | 12 comment | 0 complexity | 42543c46a391a6f8c23388ea21680328 MD5 | raw file
 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
 9/*          Copyright Sean Kelly 2008 - 2009.
10 * Distributed under the Boost Software License, Version 1.0.
11 *    (See accompanying file LICENSE or copy at
12 *          http://www.boost.org/LICENSE_1_0.txt)
13 */
14module core.sys.osx.mach.semaphore;
15
16version (OSX):
17extern (C):
18
19public import core.sys.osx.mach.kern_return;
20public import core.sys.osx.mach.port;
21
22alias mach_port_t   task_t;
23alias mach_port_t   thread_t;
24alias mach_port_t   semaphore_t;
25alias int           sync_policy_t;
26
27alias int clock_res_t;
28struct mach_timespec_t
29{
30        uint        tv_sec;
31        clock_res_t     tv_nsec;
32}
33
34enum
35{
36    SYNC_POLICY_FIFO            = 0x0,
37    SYNC_POLICY_FIXED_PRIORITY  = 0x1,
38    SYNC_POLICY_REVERSED        = 0x2,
39    SYNC_POLICY_ORDER_MASK      = 0x3,
40    SYNC_POLICY_LIFO            = (SYNC_POLICY_FIFO | SYNC_POLICY_REVERSED),
41    SYNC_POLICY_MAX                         = 0x7,
42}
43
44task_t        mach_task_self();
45kern_return_t semaphore_create(task_t, semaphore_t*, int, int);
46kern_return_t semaphore_destroy(task_t, semaphore_t);
47
48kern_return_t semaphore_signal(semaphore_t);
49kern_return_t semaphore_signal_all(semaphore_t);
50kern_return_t semaphore_signal_thread(semaphore_t, thread_t);
51
52kern_return_t semaphore_wait(semaphore_t);
53kern_return_t semaphore_wait_signal(semaphore_t, semaphore_t);
54
55kern_return_t semaphore_timedwait(semaphore_t, mach_timespec_t);
56kern_return_t semaphore_timedwait_signal(semaphore_t, semaphore_t, mach_timespec_t);