From 89fc9345dea5c675f8d93546fa3c723918d3279a Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 21 Sep 2017 15:42:45 +0200 Subject: posix: Implement self-contained POSIX rwlocks POSIX rwlocks are now available in all configurations and no longer depend on --enable-posix. Update #2514. Update #3115. --- cpukit/posix/src/prwlockdestroy.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'cpukit/posix/src/prwlockdestroy.c') diff --git a/cpukit/posix/src/prwlockdestroy.c b/cpukit/posix/src/prwlockdestroy.c index 0ced556146..49fd630ecd 100644 --- a/cpukit/posix/src/prwlockdestroy.c +++ b/cpukit/posix/src/prwlockdestroy.c @@ -20,29 +20,23 @@ #include int pthread_rwlock_destroy( - pthread_rwlock_t *rwlock + pthread_rwlock_t *_rwlock ) { POSIX_RWLock_Control *the_rwlock; Thread_queue_Context queue_context; - _Objects_Allocator_lock(); - the_rwlock = _POSIX_RWLock_Get( rwlock, &queue_context ); + the_rwlock = _POSIX_RWLock_Get( _rwlock ); + POSIX_RWLOCK_VALIDATE_OBJECT( the_rwlock ); - if ( the_rwlock == NULL ) { - _Objects_Allocator_unlock(); - return EINVAL; - } - - _CORE_RWLock_Acquire_critical( &the_rwlock->RWLock, &queue_context ); + _CORE_RWLock_Acquire( &the_rwlock->RWLock, &queue_context ); /* * If there is at least one thread waiting, then do not delete it. */ - if ( !_Thread_queue_Is_empty( &the_rwlock->RWLock.Wait_queue.Queue ) ) { + if ( !_Thread_queue_Is_empty( &the_rwlock->RWLock.Queue.Queue ) ) { _CORE_RWLock_Release( &the_rwlock->RWLock, &queue_context ); - _Objects_Allocator_unlock(); return EBUSY; } @@ -50,9 +44,7 @@ int pthread_rwlock_destroy( * POSIX doesn't require behavior when it is locked. */ - _Objects_Close( &_POSIX_RWLock_Information, &the_rwlock->Object ); + the_rwlock->flags = ~the_rwlock->flags; _CORE_RWLock_Release( &the_rwlock->RWLock, &queue_context ); - _POSIX_RWLock_Free( the_rwlock ); - _Objects_Allocator_unlock(); return 0; } -- cgit v1.2.3