home *** CD-ROM | disk | FTP | other *** search
/ H4CK3R 4 / hacker04 / 04_HACK04.ISO / darwin / darwinx86.iso / usr / include / mach / semaphore.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-09-30  |  3.2 KB  |  90 lines

  1. /*
  2.  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
  3.  *
  4.  * @APPLE_LICENSE_HEADER_START@
  5.  * 
  6.  * The contents of this file constitute Original Code as defined in and
  7.  * are subject to the Apple Public Source License Version 1.1 (the
  8.  * "License").  You may not use this file except in compliance with the
  9.  * License.  Please obtain a copy of the License at
  10.  * http://www.apple.com/publicsource and read it before using this file.
  11.  * 
  12.  * This Original Code and all software distributed under the License are
  13.  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  14.  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  15.  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
  16.  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
  17.  * License for the specific language governing rights and limitations
  18.  * under the License.
  19.  * 
  20.  * @APPLE_LICENSE_HEADER_END@
  21.  */
  22.  
  23. #ifndef _MACH_SEMAPHORE_H_
  24. #define _MACH_SEMAPHORE_H_
  25.  
  26. #include <mach/port.h>
  27. #include <mach/mach_types.h>
  28. #include <mach/kern_return.h>
  29. #include <mach/sync_policy.h>
  30.  
  31. #define SEMAPHORE_OPTION_NONE        0x00000000
  32.  
  33. #define SEMAPHORE_SIGNAL        0x00000001
  34. #define SEMAPHORE_WAIT            0x00000002
  35. #define SEMAPHORE_WAIT_ON_SIGNAL    0x00000008
  36.  
  37. #define SEMAPHORE_SIGNAL_TIMEOUT    0x00000010
  38. #define SEMAPHORE_SIGNAL_ALL        0x00000020
  39. #define SEMAPHORE_SIGNAL_INTERRUPT    0x00000040    /* libmach implements */
  40. #define SEMAPHORE_SIGNAL_PREPOST    0x00000080
  41.  
  42. #define SEMAPHORE_WAIT_TIMEOUT        0x00000100
  43. #define SEMAPHORE_WAIT_INTERRUPT    0x00000400    /* libmach implements */
  44.  
  45. #define SEMAPHORE_TIMEOUT_NOBLOCK    0x00100000
  46. #define SEMAPHORE_TIMEOUT_RELATIVE    0x00200000
  47.  
  48. #define SEMAPHORE_USE_SAVED_RESULT    0x01000000    /* internal use only */
  49. #define SEMAPHORE_SIGNAL_RELEASE    0x02000000    /* internal use only */
  50.  
  51.  
  52. /*
  53.  *    Forward Declarations
  54.  *
  55.  *    The semaphore creation and deallocation routines are
  56.  *    defined with the Mach task APIs in <mach/task.h>.
  57.  *
  58.  *      kern_return_t    semaphore_create(task_t task,
  59.  *                                       semaphore_t *new_semaphore,
  60.  *                     sync_policy_t policy,
  61.  *                     int value);
  62.  *
  63.  *    kern_return_t    semaphore_destroy(task_t task,
  64.  *                      semaphore_t semaphore);
  65.  */
  66.  
  67. extern    kern_return_t    semaphore_signal         (semaphore_t semaphore);
  68. extern    kern_return_t    semaphore_signal_all     (semaphore_t semaphore);
  69. extern    kern_return_t    semaphore_signal_thread    (semaphore_t semaphore,
  70.                          thread_act_t thread_act);
  71.  
  72. extern    kern_return_t    semaphore_wait           (semaphore_t semaphore);
  73. extern    kern_return_t    semaphore_timedwait        (semaphore_t semaphore, 
  74.                          mach_timespec_t wait_time);
  75.  
  76. extern  kern_return_t   semaphore_wait_signal   (semaphore_t wait_semaphore,
  77.                                                  semaphore_t signal_semaphore);
  78.  
  79. extern  kern_return_t semaphore_timedwait_signal(semaphore_t wait_semaphore,
  80.                                                  semaphore_t signal_semaphore,
  81.                                                  mach_timespec_t wait_time);
  82.  
  83. extern  kern_return_t    semaphore_operator    (int options,
  84.                          semaphore_t wait_semaphore,
  85.                          semaphore_t signal_semaphore,
  86.                          thread_act_t thread,
  87.                          mach_timespec_t wait_time);
  88.  
  89. #endif /* _MACH_SEMAPHORE_H_ */
  90.