summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/conddestroy.c
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/posix/src/conddestroy.c')
-rw-r--r--cpukit/posix/src/conddestroy.c26
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;
}