summaryrefslogtreecommitdiff
path: root/libpthread/linuxthreads/spinlock.c
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@uclibc-ng.org>2016-05-18 18:41:24 +0200
committerWaldemar Brodkorb <wbx@uclibc-ng.org>2016-05-18 18:41:24 +0200
commit6a8ccc95528f5e86a8770ed15ce89609b5b3dee9 (patch)
treebbd4df35b4d4a6a8b00d7a5e61fb2668b850ad62 /libpthread/linuxthreads/spinlock.c
parent398a27a5b323956344b4f831d892fed3bd9813c7 (diff)
remove linuxthreads.new, rename linuxthreads.old
Linuxthreads.new isn't really useful with the existence of NPTL/TLS for well supported architectures. There is no reason to use LT.new for ARM/MIPS or other architectures supporting NPTL/TLS. It is not available for noMMU architectures like Blackfin or FR-V. To simplify the live of the few uClibc-ng developers, LT.new is removed and LT.old is renamed to LT. LINUXTHREADS_OLD -> UCLIBC_HAS_LINUXTHREADS
Diffstat (limited to 'libpthread/linuxthreads/spinlock.c')
-rw-r--r--libpthread/linuxthreads/spinlock.c24
1 files changed, 6 insertions, 18 deletions
diff --git a/libpthread/linuxthreads/spinlock.c b/libpthread/linuxthreads/spinlock.c
index f0cf19c54..80aeda529 100644
--- a/libpthread/linuxthreads/spinlock.c
+++ b/libpthread/linuxthreads/spinlock.c
@@ -24,6 +24,8 @@
#include "spinlock.h"
#include "restart.h"
+libpthread_hidden_proto(nanosleep)
+
static void __pthread_acquire(int * spinlock);
static __inline__ void __pthread_release(int * spinlock)
@@ -63,7 +65,6 @@ void internal_function __pthread_lock(struct _pthread_fastlock * lock,
#if defined HAS_COMPARE_AND_SWAP
long oldstatus, newstatus;
int successful_seizure, spurious_wakeup_count;
- int spin_count;
#endif
#if defined TEST_FOR_COMPARE_AND_SWAP
@@ -83,11 +84,11 @@ void internal_function __pthread_lock(struct _pthread_fastlock * lock,
return;
spurious_wakeup_count = 0;
- spin_count = 0;
/* On SMP, try spinning to get the lock. */
-
+#if 0
if (__pthread_smp_kernel) {
+ int spin_count;
int max_count = lock->__spinlock * 2 + 10;
if (max_count > MAX_ADAPTIVE_SPIN_COUNT)
@@ -111,6 +112,7 @@ void internal_function __pthread_lock(struct _pthread_fastlock * lock,
lock->__spinlock += (spin_count - lock->__spinlock) / 8;
}
+#endif
again:
@@ -615,8 +617,6 @@ void __pthread_alt_unlock(struct _pthread_fastlock *lock)
if (maxprio == INT_MIN)
continue;
- ASSERT (p_max_prio != (struct wait_node *) 1);
-
/* Now we want to to remove the max priority thread's wait node from
the list. Before we can do this, we must atomically try to change the
node's abandon state from zero to nonzero. If we succeed, that means we
@@ -637,20 +637,8 @@ void __pthread_alt_unlock(struct _pthread_fastlock *lock)
#if defined HAS_COMPARE_AND_SWAP
wait_node_dequeue(pp_head, pp_max_prio, p_max_prio);
#endif
-
- /* Release the spinlock *before* restarting. */
-#if defined TEST_FOR_COMPARE_AND_SWAP
- if (!__pthread_has_cas)
-#endif
-#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP
- {
- __pthread_release(&lock->__spinlock);
- }
-#endif
-
restart(p_max_prio->thr);
-
- return;
+ break;
}
}