[rtems commit] posix: Fix fall back spinlock implementation

Sebastian Huber sebh at rtems.org
Fri Dec 2 08:57:18 UTC 2016


Module:    rtems
Branch:    master
Commit:    aadd318cd92e42839cf86260e1085f2953113180
Changeset: http://git.rtems.org/rtems/commit/?id=aadd318cd92e42839cf86260e1085f2953113180

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Dec  2 09:56:40 2016 +0100

posix: Fix fall back spinlock implementation

Update #2674.

---

 cpukit/posix/include/rtems/posix/spinlockimpl.h | 11 ++++-------
 cpukit/posix/src/pspinlock.c                    |  6 +++---
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/cpukit/posix/include/rtems/posix/spinlockimpl.h b/cpukit/posix/include/rtems/posix/spinlockimpl.h
index 36ef667..c251e45 100644
--- a/cpukit/posix/include/rtems/posix/spinlockimpl.h
+++ b/cpukit/posix/include/rtems/posix/spinlockimpl.h
@@ -48,13 +48,13 @@ typedef struct {
 } POSIX_Spinlock_Control;
 
 #if !defined(POSIX_SPINLOCKS_ARE_SELF_CONTAINED)
-#if defined(RTEMS_SMP)
 extern POSIX_Spinlock_Control _POSIX_Spinlock_Global;
 
+extern int _POSIX_Spinlock_Nest_level;
+
+#if defined(RTEMS_SMP)
 extern uint32_t _POSIX_Spinlock_Owner;
 #endif
-
-extern int _POSIX_Spinlock_Nest_level;
 #endif
 
 RTEMS_INLINE_ROUTINE POSIX_Spinlock_Control *_POSIX_Spinlock_Get(
@@ -63,12 +63,9 @@ RTEMS_INLINE_ROUTINE POSIX_Spinlock_Control *_POSIX_Spinlock_Get(
 {
 #if defined(POSIX_SPINLOCKS_ARE_SELF_CONTAINED)
   return (POSIX_Spinlock_Control *) lock;
-#elif defined(RTEMS_SMP)
-  (void) lock;
-  return &_POSIX_Spinlock_Global;
 #else
   (void) lock;
-  return NULL;
+  return &_POSIX_Spinlock_Global;
 #endif
 }
 
diff --git a/cpukit/posix/src/pspinlock.c b/cpukit/posix/src/pspinlock.c
index 4701315..2bcd59b 100644
--- a/cpukit/posix/src/pspinlock.c
+++ b/cpukit/posix/src/pspinlock.c
@@ -54,13 +54,13 @@ RTEMS_STATIC_ASSERT(
   POSIX_SPINLOCK_T_SIZE
 );
 #else
-#if defined(RTEMS_SMP)
 POSIX_Spinlock_Control _POSIX_Spinlock_Global;
 
+int _POSIX_Spinlock_Nest_level;
+
+#if defined(RTEMS_SMP)
 uint32_t _POSIX_Spinlock_Owner = 0xffffffff;
 #endif
-
-int _POSIX_Spinlock_Nest_level;
 #endif
 
 int pthread_spin_lock( pthread_spinlock_t *spinlock )



More information about the vc mailing list