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