[5e9b32b] | 1 | /* rtems/posix/cond.h |
---|
| 2 | * |
---|
| 3 | * This include file contains all the private support information for |
---|
| 4 | * POSIX condition variables. |
---|
| 5 | * |
---|
| 6 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. |
---|
| 7 | * On-Line Applications Research Corporation (OAR). |
---|
| 8 | * All rights assigned to U.S. Government, 1994. |
---|
| 9 | * |
---|
| 10 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
| 11 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
| 12 | * notice must appear in all copies of this file and its derivatives. |
---|
| 13 | * |
---|
| 14 | * $Id$ |
---|
| 15 | */ |
---|
| 16 | |
---|
| 17 | #ifndef __RTEMS_POSIX_CONDITION_VARIABLES_h |
---|
| 18 | #define __RTEMS_POSIX_CONDITION_VARIABLES_h |
---|
| 19 | |
---|
| 20 | #ifdef __cplusplus |
---|
| 21 | extern "C" { |
---|
| 22 | #endif |
---|
| 23 | |
---|
| 24 | #include <rtems/score/object.h> |
---|
| 25 | #include <rtems/score/threadq.h> |
---|
| 26 | |
---|
[57dae56] | 27 | /* |
---|
| 28 | * Constant to indicate condition variable does not currently have |
---|
| 29 | * a mutex assigned to it. |
---|
| 30 | */ |
---|
| 31 | |
---|
| 32 | #define POSIX_CONDITION_VARIABLES_NO_MUTEX 0 |
---|
| 33 | |
---|
[5e9b32b] | 34 | /* |
---|
| 35 | * Data Structure used to manage a POSIX condition variable |
---|
| 36 | */ |
---|
| 37 | |
---|
| 38 | typedef struct { |
---|
| 39 | Objects_Control Object; |
---|
| 40 | int process_shared; |
---|
| 41 | pthread_mutex_t Mutex; |
---|
| 42 | Thread_queue_Control Wait_queue; |
---|
| 43 | } POSIX_Condition_variables_Control; |
---|
| 44 | |
---|
| 45 | /* |
---|
| 46 | * The following defines the information control block used to manage |
---|
| 47 | * this class of objects. |
---|
| 48 | */ |
---|
| 49 | |
---|
[c627b2a3] | 50 | POSIX_EXTERN Objects_Information _POSIX_Condition_variables_Information; |
---|
[5e9b32b] | 51 | |
---|
| 52 | /* |
---|
| 53 | * _POSIX_Condition_variables_Manager_initialization |
---|
| 54 | * |
---|
| 55 | * DESCRIPTION: |
---|
| 56 | * |
---|
| 57 | * This routine performs the initialization necessary for this manager. |
---|
| 58 | */ |
---|
| 59 | |
---|
| 60 | void _POSIX_Condition_variables_Manager_initialization( |
---|
| 61 | unsigned32 maximum_condition_variables |
---|
| 62 | ); |
---|
| 63 | |
---|
| 64 | /* |
---|
| 65 | * _POSIX_Condition_variables_Allocate |
---|
| 66 | * |
---|
| 67 | * DESCRIPTION: |
---|
| 68 | * |
---|
| 69 | * This function allocates a condition variable control block from |
---|
| 70 | * the inactive chain of free condition variable control blocks. |
---|
| 71 | */ |
---|
| 72 | |
---|
[503dc058] | 73 | RTEMS_INLINE_ROUTINE POSIX_Condition_variables_Control * |
---|
[5e9b32b] | 74 | _POSIX_Condition_variables_Allocate( void ); |
---|
| 75 | |
---|
| 76 | /* |
---|
| 77 | * _POSIX_Condition_variables_Free |
---|
| 78 | * |
---|
| 79 | * DESCRIPTION: |
---|
| 80 | * |
---|
| 81 | * This routine frees a condition variable control block to the |
---|
| 82 | * inactive chain of free condition variable control blocks. |
---|
| 83 | */ |
---|
| 84 | |
---|
[503dc058] | 85 | RTEMS_INLINE_ROUTINE void _POSIX_Condition_variables_Free ( |
---|
[5e9b32b] | 86 | POSIX_Condition_variables_Control *the_condition_variable |
---|
| 87 | ); |
---|
| 88 | |
---|
| 89 | /* |
---|
| 90 | * _POSIX_Condition_variables_Get |
---|
| 91 | * |
---|
| 92 | * DESCRIPTION: |
---|
| 93 | * |
---|
| 94 | * This function maps condition variable IDs to condition variable control |
---|
| 95 | * blocks. If ID corresponds to a local condition variable, then it returns |
---|
| 96 | * the_condition variable control pointer which maps to ID and location |
---|
| 97 | * is set to OBJECTS_LOCAL. if the condition variable ID is global and |
---|
| 98 | * resides on a remote node, then location is set to OBJECTS_REMOTE, |
---|
| 99 | * and the_condition variable is undefined. Otherwise, location is set |
---|
| 100 | * to OBJECTS_ERROR and the_condition variable is undefined. |
---|
| 101 | */ |
---|
| 102 | |
---|
[503dc058] | 103 | RTEMS_INLINE_ROUTINE POSIX_Condition_variables_Control *_POSIX_Condition_variables_Get ( |
---|
[5e9b32b] | 104 | Objects_Id *id, |
---|
| 105 | Objects_Locations *location |
---|
| 106 | ); |
---|
| 107 | |
---|
| 108 | /* |
---|
| 109 | * _POSIX_Condition_variables_Is_null |
---|
| 110 | * |
---|
| 111 | * DESCRIPTION: |
---|
| 112 | * |
---|
| 113 | * This function returns TRUE if the_condition variable is NULL |
---|
| 114 | * and FALSE otherwise. |
---|
| 115 | */ |
---|
| 116 | |
---|
[503dc058] | 117 | RTEMS_INLINE_ROUTINE boolean _POSIX_Condition_variables_Is_null ( |
---|
[5e9b32b] | 118 | POSIX_Condition_variables_Control *the_condition_variable |
---|
| 119 | ); |
---|
| 120 | |
---|
| 121 | #include <rtems/posix/cond.inl> |
---|
| 122 | #include <rtems/posix/condmp.h> |
---|
| 123 | |
---|
| 124 | #ifdef __cplusplus |
---|
| 125 | } |
---|
| 126 | #endif |
---|
| 127 | |
---|
| 128 | #endif |
---|
| 129 | /* end of include file */ |
---|
| 130 | |
---|