[rtems commit] configure: Remove SIZEOF_PTHREAD_SPINLOCK_T

Sebastian Huber sebh at rtems.org
Fri Jan 13 08:47:01 UTC 2017


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Jan 13 09:45:59 2017 +0100

configure: Remove SIZEOF_PTHREAD_SPINLOCK_T

---

 cpukit/configure.ac                             |  1 -
 cpukit/posix/include/rtems/posix/spinlockimpl.h | 19 ----------------
 cpukit/posix/src/pspindestroy.c                 |  2 +-
 cpukit/posix/src/pspininit.c                    |  2 +-
 cpukit/posix/src/pspinlock.c                    | 30 -------------------------
 cpukit/posix/src/pspinunlock.c                  | 13 -----------
 6 files changed, 2 insertions(+), 65 deletions(-)

diff --git a/cpukit/configure.ac b/cpukit/configure.ac
index 945bd30..444b886 100644
--- a/cpukit/configure.ac
+++ b/cpukit/configure.ac
@@ -74,7 +74,6 @@ AC_CHECK_HEADERS([envlock.h])
 AC_CHECK_DECLS([__env_lock],,,[#include <envlock.h>])
 AC_CHECK_DECLS([__env_unlock],,,[#include <envlock.h>])
 AC_CHECK_TYPES([struct _Thread_queue_Queue],[],[],[#include <sys/lock.h>])
-AC_CHECK_SIZEOF([pthread_spinlock_t],[],[],[#include <pthread.h>])
 AC_CHECK_MEMBER([struct _Thread_queue_Queue._name],[],[RTEMS_TOOL_CHAIN_ERROR],[#include <sys/lock.h>])
 
 # Mandated by POSIX, older newlibs bogusly provided CLOCK_PROCESS_CPUTIME+CLOCK_THREAD_CPUTIME
diff --git a/cpukit/posix/include/rtems/posix/spinlockimpl.h b/cpukit/posix/include/rtems/posix/spinlockimpl.h
index c251e45..d28e039 100644
--- a/cpukit/posix/include/rtems/posix/spinlockimpl.h
+++ b/cpukit/posix/include/rtems/posix/spinlockimpl.h
@@ -34,10 +34,6 @@
 extern "C" {
 #endif
 
-#if SIZEOF_PTHREAD_SPINLOCK_T > 4
-#define POSIX_SPINLOCKS_ARE_SELF_CONTAINED
-#endif
-
 typedef struct {
 #if defined(RTEMS_SMP)
   SMP_ticket_lock_Control Lock;
@@ -47,26 +43,11 @@ typedef struct {
   ISR_Level interrupt_state;
 } POSIX_Spinlock_Control;
 
-#if !defined(POSIX_SPINLOCKS_ARE_SELF_CONTAINED)
-extern POSIX_Spinlock_Control _POSIX_Spinlock_Global;
-
-extern int _POSIX_Spinlock_Nest_level;
-
-#if defined(RTEMS_SMP)
-extern uint32_t _POSIX_Spinlock_Owner;
-#endif
-#endif
-
 RTEMS_INLINE_ROUTINE POSIX_Spinlock_Control *_POSIX_Spinlock_Get(
   pthread_spinlock_t *lock
 )
 {
-#if defined(POSIX_SPINLOCKS_ARE_SELF_CONTAINED)
   return (POSIX_Spinlock_Control *) lock;
-#else
-  (void) lock;
-  return &_POSIX_Spinlock_Global;
-#endif
 }
 
 #ifdef __cplusplus
diff --git a/cpukit/posix/src/pspindestroy.c b/cpukit/posix/src/pspindestroy.c
index f5de88f..3963fe8 100644
--- a/cpukit/posix/src/pspindestroy.c
+++ b/cpukit/posix/src/pspindestroy.c
@@ -24,7 +24,7 @@
 
 int pthread_spin_destroy( pthread_spinlock_t *spinlock )
 {
-#if defined(RTEMS_SMP) && defined(POSIX_SPINLOCKS_ARE_SELF_CONTAINED)
+#if defined(RTEMS_SMP)
   POSIX_Spinlock_Control *the_spinlock;
 
   the_spinlock = _POSIX_Spinlock_Get( spinlock );
diff --git a/cpukit/posix/src/pspininit.c b/cpukit/posix/src/pspininit.c
index 313633a..6a7bd03 100644
--- a/cpukit/posix/src/pspininit.c
+++ b/cpukit/posix/src/pspininit.c
@@ -29,7 +29,7 @@ int pthread_spin_init(
   int                  pshared
 )
 {
-#if defined(RTEMS_SMP) && defined(POSIX_SPINLOCKS_ARE_SELF_CONTAINED)
+#if defined(RTEMS_SMP)
   POSIX_Spinlock_Control *the_spinlock;
 
   the_spinlock = _POSIX_Spinlock_Get( spinlock );
diff --git a/cpukit/posix/src/pspinlock.c b/cpukit/posix/src/pspinlock.c
index 2bcd59b..9bacd36 100644
--- a/cpukit/posix/src/pspinlock.c
+++ b/cpukit/posix/src/pspinlock.c
@@ -22,7 +22,6 @@
 
 #include <rtems/posix/spinlockimpl.h>
 
-#if defined(POSIX_SPINLOCKS_ARE_SELF_CONTAINED)
 RTEMS_STATIC_ASSERT(
 #if defined(RTEMS_SMP)
   offsetof( POSIX_Spinlock_Control, Lock.next_ticket )
@@ -53,15 +52,6 @@ RTEMS_STATIC_ASSERT(
   sizeof( POSIX_Spinlock_Control ) == sizeof( pthread_spinlock_t ),
   POSIX_SPINLOCK_T_SIZE
 );
-#else
-POSIX_Spinlock_Control _POSIX_Spinlock_Global;
-
-int _POSIX_Spinlock_Nest_level;
-
-#if defined(RTEMS_SMP)
-uint32_t _POSIX_Spinlock_Owner = 0xffffffff;
-#endif
-#endif
 
 int pthread_spin_lock( pthread_spinlock_t *spinlock )
 {
@@ -73,7 +63,6 @@ int pthread_spin_lock( pthread_spinlock_t *spinlock )
 
   the_spinlock = _POSIX_Spinlock_Get( spinlock );
   _ISR_Local_disable( level );
-#if defined(POSIX_SPINLOCKS_ARE_SELF_CONTAINED)
 #if defined(RTEMS_SMP)
 #if defined(RTEMS_PROFILING)
   /* The lock statistics are incorrect in case of nested pthread spinlocks */
@@ -86,25 +75,6 @@ int pthread_spin_lock( pthread_spinlock_t *spinlock )
   );
 #endif
   the_spinlock->interrupt_state = level;
-#else
-#if defined(RTEMS_SMP)
-  if ( _POSIX_Spinlock_Owner != _SMP_Get_current_processor() ) {
-#if defined(RTEMS_PROFILING)
-    cpu_self = _Per_CPU_Get();
-#endif
-    _SMP_ticket_lock_Acquire(
-      &the_spinlock->Lock,
-      &cpu_self->Lock_stats,
-      &cpu_self->Lock_stats_context
-    );
-    _POSIX_Spinlock_Owner = _SMP_Get_current_processor();
-  }
-#endif
-
-  if ( ++_POSIX_Spinlock_Nest_level == 1) {
-    the_spinlock->interrupt_state = level;
-  }
-#endif
   return 0;
 }
 
diff --git a/cpukit/posix/src/pspinunlock.c b/cpukit/posix/src/pspinunlock.c
index b508df7..74baa7c 100644
--- a/cpukit/posix/src/pspinunlock.c
+++ b/cpukit/posix/src/pspinunlock.c
@@ -31,7 +31,6 @@ int pthread_spin_unlock( pthread_spinlock_t *lock )
 
   the_spinlock = _POSIX_Spinlock_Get( lock );
   level = the_spinlock->interrupt_state;
-#if defined(POSIX_SPINLOCKS_ARE_SELF_CONTAINED)
 #if defined(RTEMS_SMP)
   _SMP_ticket_lock_Release(
     &the_spinlock->Lock,
@@ -39,17 +38,5 @@ int pthread_spin_unlock( pthread_spinlock_t *lock )
   );
 #endif
   _ISR_Local_enable( level );
-#else
-  if ( --_POSIX_Spinlock_Nest_level == 0 ) {
-#if defined(RTEMS_SMP)
-    _POSIX_Spinlock_Owner = 0xffffffff;
-    _SMP_ticket_lock_Release(
-      &the_spinlock->Lock,
-      &_Per_CPU_Get()->Lock_stats_context
-    );
-#endif
-    _ISR_Local_enable( level );
-  }
-#endif
   return 0;
 }



More information about the vc mailing list