summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src/semdelete.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/rtems/src/semdelete.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/rtems/src/semdelete.c')
-rw-r--r--cpukit/rtems/src/semdelete.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/cpukit/rtems/src/semdelete.c b/cpukit/rtems/src/semdelete.c
index ea82b7757d..6e7c5eafad 100644
--- a/cpukit/rtems/src/semdelete.c
+++ b/cpukit/rtems/src/semdelete.c
@@ -44,6 +44,8 @@ rtems_status_code rtems_semaphore_delete(
Semaphore_Control *the_semaphore;
Objects_Locations location;
+ _Objects_Allocator_lock();
+
the_semaphore = _Semaphore_Get( id, &location );
switch ( location ) {
@@ -53,6 +55,7 @@ rtems_status_code rtems_semaphore_delete(
!_Attributes_Is_simple_binary_semaphore(
the_semaphore->attribute_set ) ) {
_Objects_Put( &the_semaphore->Object );
+ _Objects_Allocator_unlock();
return RTEMS_RESOURCE_IN_USE;
}
_CORE_mutex_Flush(
@@ -70,8 +73,6 @@ rtems_status_code rtems_semaphore_delete(
_Objects_Close( &_Semaphore_Information, &the_semaphore->Object );
- _Semaphore_Free( the_semaphore );
-
#if defined(RTEMS_MULTIPROCESSING)
if ( _Attributes_Is_global( the_semaphore->attribute_set ) ) {
@@ -85,12 +86,15 @@ rtems_status_code rtems_semaphore_delete(
);
}
#endif
+
_Objects_Put( &the_semaphore->Object );
+ _Semaphore_Free( the_semaphore );
+ _Objects_Allocator_unlock();
return RTEMS_SUCCESSFUL;
#if defined(RTEMS_MULTIPROCESSING)
case OBJECTS_REMOTE:
- _Thread_Dispatch();
+ _Objects_Allocator_unlock();
return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
#endif
@@ -98,5 +102,6 @@ rtems_status_code rtems_semaphore_delete(
break;
}
+ _Objects_Allocator_unlock();
return RTEMS_INVALID_ID;
}