summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-04-08 16:23:22 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-04-18 08:20:12 +0200
commit362722795abb917fb53d8903eae450c78ba43be4 (patch)
treeea2c0403179d4b9a29c814b39a7903e2c45261f0
parentscore: Add Chain_Iterator (diff)
downloadrtems-362722795abb917fb53d8903eae450c78ba43be4.tar.bz2
sapi: Avoid Giant lock for extensions
Extension create and delete is protected by the object allocator lock. Update #2555.
-rw-r--r--cpukit/sapi/include/rtems/extensionimpl.h7
-rw-r--r--cpukit/sapi/src/extensiondelete.c33
2 files changed, 15 insertions, 25 deletions
diff --git a/cpukit/sapi/include/rtems/extensionimpl.h b/cpukit/sapi/include/rtems/extensionimpl.h
index e26731cbcc..64ac600520 100644
--- a/cpukit/sapi/include/rtems/extensionimpl.h
+++ b/cpukit/sapi/include/rtems/extensionimpl.h
@@ -39,13 +39,10 @@ RTEMS_INLINE_ROUTINE void _Extension_Free (
_Objects_Free( &_Extension_Information, &the_extension->Object );
}
-RTEMS_INLINE_ROUTINE Extension_Control *_Extension_Get (
- Objects_Id id,
- Objects_Locations *location
-)
+RTEMS_INLINE_ROUTINE Extension_Control *_Extension_Get( Objects_Id id )
{
return (Extension_Control *)
- _Objects_Get( &_Extension_Information, id, location );
+ _Objects_Get_no_protection( &_Extension_Information, id );
}
#ifdef __cplusplus
diff --git a/cpukit/sapi/src/extensiondelete.c b/cpukit/sapi/src/extensiondelete.c
index f851ea06c2..af2bd83f18 100644
--- a/cpukit/sapi/src/extensiondelete.c
+++ b/cpukit/sapi/src/extensiondelete.c
@@ -20,35 +20,28 @@
#endif
#include <rtems/extensionimpl.h>
-#include <rtems/score/thread.h>
#include <rtems/score/userextimpl.h>
rtems_status_code rtems_extension_delete(
rtems_id id
)
{
- Extension_Control *the_extension;
- Objects_Locations location;
+ rtems_status_code status;
+ Extension_Control *the_extension;
_Objects_Allocator_lock();
- the_extension = _Extension_Get( id, &location );
- switch ( location ) {
- case OBJECTS_LOCAL:
- _User_extensions_Remove_set( &the_extension->Extension );
- _Objects_Close( &_Extension_Information, &the_extension->Object );
- _Objects_Put( &the_extension->Object );
- _Extension_Free( the_extension );
- _Objects_Allocator_unlock();
- return RTEMS_SUCCESSFUL;
-
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE: /* should never return this */
-#endif
- case OBJECTS_ERROR:
- break;
+
+ the_extension = _Extension_Get( id );
+
+ if ( the_extension != NULL ) {
+ _Objects_Close( &_Extension_Information, &the_extension->Object );
+ _User_extensions_Remove_set( &the_extension->Extension );
+ _Extension_Free( the_extension );
+ status = RTEMS_SUCCESSFUL;
+ } else {
+ status = RTEMS_INVALID_ID;
}
_Objects_Allocator_unlock();
-
- return RTEMS_INVALID_ID;
+ return status;
}