[rtems commit] score: Relax Giant lock usage for API mutexes
Sebastian Huber
sebh at rtems.org
Mon Mar 31 08:09:16 UTC 2014
Module: rtems
Branch: master
Commit: fb7199d3a27036e2de408caef1a8c755dc986050
Changeset: http://git.rtems.org/rtems/commit/?id=fb7199d3a27036e2de408caef1a8c755dc986050
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Thu Mar 13 15:25:06 2014 +0100
score: Relax Giant lock usage for API mutexes
It is no longer necessary to protect the workspace allocations with the
Giant lock due to the thread life cycle re-implementation.
---
cpukit/posix/src/pthread.c | 2 +-
cpukit/score/src/apimutexlock.c | 4 ++++
cpukit/score/src/apimutexunlock.c | 5 +----
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/cpukit/posix/src/pthread.c b/cpukit/posix/src/pthread.c
index 8d1a8eb..512cd70 100644
--- a/cpukit/posix/src/pthread.c
+++ b/cpukit/posix/src/pthread.c
@@ -227,7 +227,7 @@ static bool _POSIX_Threads_Create_extension(
&& _Objects_Get_class( created->Object.id ) == 1
#endif
) {
- executing_api = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
+ executing_api = _Thread_Get_executing()->API_Extensions[ THREAD_API_POSIX ];
api->signals_blocked = executing_api->signals_blocked;
} else {
api->signals_blocked = SIGNAL_ALL_MASK;
diff --git a/cpukit/score/src/apimutexlock.c b/cpukit/score/src/apimutexlock.c
index 91f6af3..d943bdd 100644
--- a/cpukit/score/src/apimutexlock.c
+++ b/cpukit/score/src/apimutexlock.c
@@ -43,4 +43,8 @@ void _API_Mutex_Lock(
0,
level
);
+
+ #if defined(RTEMS_SMP)
+ _Thread_Enable_dispatch();
+ #endif
}
diff --git a/cpukit/score/src/apimutexunlock.c b/cpukit/score/src/apimutexunlock.c
index 354033c..43bdfe8 100644
--- a/cpukit/score/src/apimutexunlock.c
+++ b/cpukit/score/src/apimutexunlock.c
@@ -27,10 +27,7 @@ void _API_Mutex_Unlock(
API_Mutex_Control *the_mutex
)
{
- /* Dispatch is already disabled in SMP while lock is held. */
- #if !defined(RTEMS_SMP)
- _Thread_Disable_dispatch();
- #endif
+ _Thread_Disable_dispatch();
_CORE_mutex_Surrender(
&the_mutex->Mutex,
the_mutex->Object.id,
More information about the vc
mailing list