summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/prwlockdestroy.c
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/posix/src/prwlockdestroy.c')
-rw-r--r--cpukit/posix/src/prwlockdestroy.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/cpukit/posix/src/prwlockdestroy.c b/cpukit/posix/src/prwlockdestroy.c
index 9054e921de..d1261ca4fb 100644
--- a/cpukit/posix/src/prwlockdestroy.c
+++ b/cpukit/posix/src/prwlockdestroy.c
@@ -44,6 +44,7 @@ int pthread_rwlock_destroy(
if ( !rwlock )
return EINVAL;
+ _Objects_Allocator_lock();
the_rwlock = _POSIX_RWLock_Get( rwlock, &location );
switch ( location ) {
@@ -53,6 +54,7 @@ int pthread_rwlock_destroy(
*/
if ( _Thread_queue_First( &the_rwlock->RWLock.Wait_queue ) != NULL ) {
_Objects_Put( &the_rwlock->Object );
+ _Objects_Allocator_unlock();
return EBUSY;
}
@@ -61,10 +63,10 @@ int pthread_rwlock_destroy(
*/
_Objects_Close( &_POSIX_RWLock_Information, &the_rwlock->Object );
-
+ _Objects_Put( &the_rwlock->Object );
_POSIX_RWLock_Free( the_rwlock );
+ _Objects_Allocator_unlock();
- _Objects_Put( &the_rwlock->Object );
return 0;
#if defined(RTEMS_MULTIPROCESSING)
@@ -74,5 +76,7 @@ int pthread_rwlock_destroy(
break;
}
+ _Objects_Allocator_unlock();
+
return EINVAL;
}