[PATCH 2/4] sapi: Avoid Giant lock for extensions
Sebastian Huber
sebastian.huber at embedded-brains.de
Fri Apr 15 09:16:06 UTC 2016
Extension create and delete is protected by the object allocator lock.
Update #2555.
---
cpukit/sapi/include/rtems/extensionimpl.h | 7 ++-----
cpukit/sapi/src/extensiondelete.c | 33 ++++++++++++-------------------
2 files changed, 15 insertions(+), 25 deletions(-)
diff --git a/cpukit/sapi/include/rtems/extensionimpl.h b/cpukit/sapi/include/rtems/extensionimpl.h
index e26731c..64ac600 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 f851ea0..4cfc99c 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 ) {
+ _User_extensions_Remove_set( &the_extension->Extension );
+ _Objects_Close( &_Extension_Information, &the_extension->Object );
+ _Extension_Free( the_extension );
+ status = RTEMS_SUCCESSFUL;
+ } else {
+ status = RTEMS_INVALID_ID;
}
_Objects_Allocator_unlock();
-
- return RTEMS_INVALID_ID;
+ return status;
}
--
1.8.4.5
More information about the devel
mailing list