summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/prwlockdestroy.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-03-27 14:16:12 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-03-31 08:29:44 +0200
commit23fec9f0e18dc4913fab818118f836af150b98f3 (patch)
tree66228f23bbf654117a33e28db7a017eea21fb785 /cpukit/posix/src/prwlockdestroy.c
parentscore: Use thread life protection for API mutexes (diff)
downloadrtems-23fec9f0e18dc4913fab818118f836af150b98f3.tar.bz2
score: PR2152: Use allocator mutex for objects
Use allocator mutex for objects allocate/free. This prevents that the thread dispatch latency depends on the workspace/heap fragmentation.
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;
}