4.104.115
Line | |
---|
1 | /* |
---|
2 | * COPYRIGHT (c) 1989-2007. |
---|
3 | * On-Line Applications Research Corporation (OAR). |
---|
4 | * |
---|
5 | * The license and distribution terms for this file may be |
---|
6 | * found in the file LICENSE in this distribution or at |
---|
7 | * http://www.rtems.com/license/LICENSE. |
---|
8 | * |
---|
9 | * $Id$ |
---|
10 | */ |
---|
11 | |
---|
12 | #if HAVE_CONFIG_H |
---|
13 | #include "config.h" |
---|
14 | #endif |
---|
15 | |
---|
16 | #include <pthread.h> |
---|
17 | #include <errno.h> |
---|
18 | |
---|
19 | #include <rtems/system.h> |
---|
20 | #include <rtems/score/object.h> |
---|
21 | #include <rtems/score/states.h> |
---|
22 | #include <rtems/score/watchdog.h> |
---|
23 | #include <rtems/posix/cond.h> |
---|
24 | #include <rtems/posix/time.h> |
---|
25 | #include <rtems/posix/mutex.h> |
---|
26 | |
---|
27 | POSIX_Condition_variables_Control *_POSIX_Condition_variables_Get ( |
---|
28 | pthread_cond_t *cond, |
---|
29 | Objects_Locations *location |
---|
30 | ) |
---|
31 | { |
---|
32 | int status; |
---|
33 | |
---|
34 | if ( !cond ) { |
---|
35 | *location = OBJECTS_ERROR; |
---|
36 | return (POSIX_Condition_variables_Control *) 0; |
---|
37 | } |
---|
38 | |
---|
39 | if ( *cond == PTHREAD_COND_INITIALIZER ) { |
---|
40 | /* |
---|
41 | * Do an "auto-create" here. |
---|
42 | */ |
---|
43 | |
---|
44 | status = pthread_cond_init( cond, 0 ); |
---|
45 | if ( status ) { |
---|
46 | *location = OBJECTS_ERROR; |
---|
47 | return (POSIX_Condition_variables_Control *) 0; |
---|
48 | } |
---|
49 | } |
---|
50 | |
---|
51 | /* |
---|
52 | * Now call Objects_Get() |
---|
53 | */ |
---|
54 | return (POSIX_Condition_variables_Control *)_Objects_Get( |
---|
55 | &_POSIX_Condition_variables_Information, |
---|
56 | (Objects_Id) *cond, |
---|
57 | location |
---|
58 | ); |
---|
59 | } |
---|
60 | |
---|
Note: See
TracBrowser
for help on using the repository browser.