diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-09-26 07:49:17 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-10-05 14:29:02 +0200 |
commit | 5222488573e3ba8c2eceffe29f878a73a3a81694 (patch) | |
tree | 4b4ca72268b8f40da493ca252780c197bd23a5ef /cpukit/posix/src/conddestroy.c | |
parent | posix: Implement self-contained POSIX rwlocks (diff) | |
download | rtems-5222488573e3ba8c2eceffe29f878a73a3a81694.tar.bz2 |
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.
Diffstat (limited to 'cpukit/posix/src/conddestroy.c')
-rw-r--r-- | cpukit/posix/src/conddestroy.c | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/cpukit/posix/src/conddestroy.c b/cpukit/posix/src/conddestroy.c index a2c8dc188f..63214362dc 100644 --- a/cpukit/posix/src/conddestroy.c +++ b/cpukit/posix/src/conddestroy.c @@ -24,36 +24,24 @@ * 11.4.2 Initializing and Destroying a Condition Variable, * P1003.1c/Draft 10, p. 87 */ -int pthread_cond_destroy( - pthread_cond_t *cond -) +int pthread_cond_destroy( pthread_cond_t *cond ) { POSIX_Condition_variables_Control *the_cond; + unsigned long flags; Thread_queue_Context queue_context; - _Objects_Allocator_lock(); - the_cond = _POSIX_Condition_variables_Get( cond, &queue_context ); + the_cond = _POSIX_Condition_variables_Get( cond ); + POSIX_CONDITION_VARIABLES_VALIDATE_OBJECT( the_cond, flags ); - if ( the_cond == NULL ) { - _Objects_Allocator_unlock(); - return EINVAL; - } - - _POSIX_Condition_variables_Acquire_critical( the_cond, &queue_context ); + _Thread_queue_Context_initialize( &queue_context ); + _POSIX_Condition_variables_Acquire( the_cond, &queue_context ); - if ( !_Thread_queue_Is_empty( &the_cond->Wait_queue.Queue ) ) { + if ( !_Thread_queue_Is_empty( &the_cond->Queue.Queue ) ) { _POSIX_Condition_variables_Release( the_cond, &queue_context ); - _Objects_Allocator_unlock(); return EBUSY; } - _Objects_Close( - &_POSIX_Condition_variables_Information, - &the_cond->Object - ); _POSIX_Condition_variables_Release( the_cond, &queue_context ); _POSIX_Condition_variables_Destroy( the_cond ); - _POSIX_Condition_variables_Free( the_cond ); - _Objects_Allocator_unlock(); return 0; } |