[5e9b32b] | 1 | /* rtems/posix/cond.inl |
---|
| 2 | * |
---|
| 3 | * This include file contains the static inline implementation of the private |
---|
| 4 | * inlined routines for POSIX condition variables. |
---|
| 5 | * |
---|
[2837a5e] | 6 | * COPYRIGHT (c) 1989-2002. |
---|
[5e9b32b] | 7 | * On-Line Applications Research Corporation (OAR). |
---|
| 8 | * |
---|
[98e4ebf5] | 9 | * The license and distribution terms for this file may be |
---|
| 10 | * found in the file LICENSE in this distribution or at |
---|
[03f2154e] | 11 | * http://www.OARcorp.com/rtems/license.html. |
---|
[5e9b32b] | 12 | * |
---|
| 13 | * $Id$ |
---|
| 14 | */ |
---|
| 15 | |
---|
| 16 | #ifndef __RTEMS_POSIX_CONDITION_VARIABLES_inl |
---|
| 17 | #define __RTEMS_POSIX_CONDITION_VARIABLES_inl |
---|
| 18 | |
---|
[2837a5e] | 19 | #include <pthread.h> |
---|
| 20 | |
---|
[5e9b32b] | 21 | /*PAGE |
---|
| 22 | * |
---|
| 23 | * _POSIX_Condition_variables_Allocate |
---|
| 24 | */ |
---|
| 25 | |
---|
[503dc058] | 26 | RTEMS_INLINE_ROUTINE POSIX_Condition_variables_Control |
---|
[5e9b32b] | 27 | *_POSIX_Condition_variables_Allocate( void ) |
---|
| 28 | { |
---|
| 29 | return (POSIX_Condition_variables_Control *) |
---|
| 30 | _Objects_Allocate( &_POSIX_Condition_variables_Information ); |
---|
| 31 | } |
---|
| 32 | |
---|
| 33 | /*PAGE |
---|
| 34 | * |
---|
| 35 | * _POSIX_Condition_variables_Free |
---|
| 36 | */ |
---|
| 37 | |
---|
[503dc058] | 38 | RTEMS_INLINE_ROUTINE void _POSIX_Condition_variables_Free ( |
---|
[5e9b32b] | 39 | POSIX_Condition_variables_Control *the_condition_variable |
---|
| 40 | ) |
---|
| 41 | { |
---|
| 42 | _Objects_Free( |
---|
| 43 | &_POSIX_Condition_variables_Information, |
---|
| 44 | &the_condition_variable->Object |
---|
| 45 | ); |
---|
| 46 | } |
---|
| 47 | |
---|
| 48 | /*PAGE |
---|
| 49 | * |
---|
| 50 | * _POSIX_Condition_variables_Get |
---|
| 51 | */ |
---|
[2837a5e] | 52 | |
---|
| 53 | RTEMS_INLINE_ROUTINE POSIX_Condition_variables_Control |
---|
| 54 | *_POSIX_Condition_variables_Get ( |
---|
[5e9b32b] | 55 | Objects_Id *id, |
---|
| 56 | Objects_Locations *location |
---|
| 57 | ) |
---|
| 58 | { |
---|
[2837a5e] | 59 | int status; |
---|
| 60 | |
---|
| 61 | if ( !id ) { |
---|
| 62 | *location = OBJECTS_ERROR; |
---|
| 63 | return (POSIX_Condition_variables_Control *) 0; |
---|
| 64 | } |
---|
| 65 | |
---|
| 66 | if ( *id == PTHREAD_COND_INITIALIZER ) { |
---|
| 67 | /* |
---|
| 68 | * Do an "auto-create" here. |
---|
| 69 | */ |
---|
| 70 | |
---|
| 71 | status = pthread_cond_init( id, 0 ); |
---|
| 72 | if ( status ) { |
---|
| 73 | *location = OBJECTS_ERROR; |
---|
| 74 | return (POSIX_Condition_variables_Control *) 0; |
---|
| 75 | } |
---|
| 76 | } |
---|
| 77 | |
---|
| 78 | /* |
---|
| 79 | * Now call Objects_Get() |
---|
| 80 | */ |
---|
[df49c60] | 81 | |
---|
[2837a5e] | 82 | return (POSIX_Condition_variables_Control *) |
---|
| 83 | _Objects_Get( &_POSIX_Condition_variables_Information, *id, location ); |
---|
[5e9b32b] | 84 | } |
---|
| 85 | |
---|
| 86 | /*PAGE |
---|
| 87 | * |
---|
| 88 | * _POSIX_Condition_variables_Is_null |
---|
| 89 | */ |
---|
| 90 | |
---|
[503dc058] | 91 | RTEMS_INLINE_ROUTINE boolean _POSIX_Condition_variables_Is_null ( |
---|
[5e9b32b] | 92 | POSIX_Condition_variables_Control *the_condition_variable |
---|
| 93 | ) |
---|
| 94 | { |
---|
| 95 | return !the_condition_variable; |
---|
| 96 | } |
---|
| 97 | |
---|
| 98 | #endif |
---|
| 99 | /* end of include file */ |
---|
| 100 | |
---|