summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/pspinunlock.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-03-18 14:03:01 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-03-18 15:36:58 +0100
commit5a5fb3b9d6d99d6751d129458217f1a3b5b85ff8 (patch)
tree9f2296b7e4abaa0da454caea84e2fcbc0eb49fd2 /cpukit/posix/src/pspinunlock.c
parentscore: Add _Objects_Get_by_name() (diff)
downloadrtems-5a5fb3b9d6d99d6751d129458217f1a3b5b85ff8.tar.bz2
score: Avoid Giant lock for CORE spinlock
Use an ISR lock to protect the spinlock state. Remove empty attributes. Update #2555.
Diffstat (limited to 'cpukit/posix/src/pspinunlock.c')
-rw-r--r--cpukit/posix/src/pspinunlock.c47
1 files changed, 9 insertions, 38 deletions
diff --git a/cpukit/posix/src/pspinunlock.c b/cpukit/posix/src/pspinunlock.c
index 3a483adab0..35dbcb977f 100644
--- a/cpukit/posix/src/pspinunlock.c
+++ b/cpukit/posix/src/pspinunlock.c
@@ -20,50 +20,21 @@
#include "config.h"
#endif
-#include <pthread.h>
-#include <errno.h>
-
-#include <rtems/system.h>
#include <rtems/posix/spinlockimpl.h>
-/*
- * pthread_spin_unlock
- *
- * This directive allows a thread to wait at a spinlock.
- *
- * Input parameters:
- * spinlock - spinlock id
- *
- * Output parameters:
- * 0 - if successful
- * error code - if unsuccessful
- */
+#include <errno.h>
-int pthread_spin_unlock(
- pthread_spinlock_t *spinlock
-)
+int pthread_spin_unlock( pthread_spinlock_t *spinlock )
{
- POSIX_Spinlock_Control *the_spinlock = NULL;
- Objects_Locations location;
- CORE_spinlock_Status status;
+ POSIX_Spinlock_Control *the_spinlock;
+ ISR_lock_Context lock_context;
+ CORE_spinlock_Status status;
- if ( !spinlock )
+ the_spinlock = _POSIX_Spinlock_Get( spinlock, &lock_context );
+ if ( the_spinlock == NULL ) {
return EINVAL;
-
- the_spinlock = _POSIX_Spinlock_Get( spinlock, &location );
- switch ( location ) {
-
- case OBJECTS_LOCAL:
- status = _CORE_spinlock_Release( &the_spinlock->Spinlock );
- _Objects_Put( &the_spinlock->Object );
- return _POSIX_Spinlock_Translate_core_spinlock_return_code( status );
-
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- break;
}
- return EINVAL;
+ status = _CORE_spinlock_Surrender( &the_spinlock->Spinlock, &lock_context );
+ return _POSIX_Spinlock_Translate_core_spinlock_return_code( status );
}