5
Last change
on this file since dbb30e26 was
5222488,
checked in by Sebastian Huber <sebastian.huber@…>, on 09/26/17 at 05:49:17
|
posix: Implement self-contained POSIX condvar
POSIX condition variables are now available in all configurations and no
longer depend on --enable-posix.
Update #2514.
Update #3113.
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Destroy a Condition Variable |
---|
5 | * @ingroup POSIXAPI |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * COPYRIGHT (c) 1989-2007. |
---|
10 | * On-Line Applications Research Corporation (OAR). |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.org/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #if HAVE_CONFIG_H |
---|
18 | #include "config.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #include <rtems/posix/condimpl.h> |
---|
22 | |
---|
23 | /** |
---|
24 | * 11.4.2 Initializing and Destroying a Condition Variable, |
---|
25 | * P1003.1c/Draft 10, p. 87 |
---|
26 | */ |
---|
27 | int pthread_cond_destroy( pthread_cond_t *cond ) |
---|
28 | { |
---|
29 | POSIX_Condition_variables_Control *the_cond; |
---|
30 | unsigned long flags; |
---|
31 | Thread_queue_Context queue_context; |
---|
32 | |
---|
33 | the_cond = _POSIX_Condition_variables_Get( cond ); |
---|
34 | POSIX_CONDITION_VARIABLES_VALIDATE_OBJECT( the_cond, flags ); |
---|
35 | |
---|
36 | _Thread_queue_Context_initialize( &queue_context ); |
---|
37 | _POSIX_Condition_variables_Acquire( the_cond, &queue_context ); |
---|
38 | |
---|
39 | if ( !_Thread_queue_Is_empty( &the_cond->Queue.Queue ) ) { |
---|
40 | _POSIX_Condition_variables_Release( the_cond, &queue_context ); |
---|
41 | return EBUSY; |
---|
42 | } |
---|
43 | |
---|
44 | _POSIX_Condition_variables_Release( the_cond, &queue_context ); |
---|
45 | _POSIX_Condition_variables_Destroy( the_cond ); |
---|
46 | return 0; |
---|
47 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.