diff options
| author | John Polstra <jdp@FreeBSD.org> | 2002-07-11 23:52:32 +0000 |
|---|---|---|
| committer | John Polstra <jdp@FreeBSD.org> | 2002-07-11 23:52:32 +0000 |
| commit | 6beb55de6aa8f2ff8e8b50366d8b4ecaae3e457d (patch) | |
| tree | 49975ea54b65fecc24e654972e2731e206afeb8d /libexec/rtld-elf | |
| parent | c577339cffd5066fd9040c2cc6b1e53355c8bcdc (diff) | |
Notes
Diffstat (limited to 'libexec/rtld-elf')
| -rw-r--r-- | libexec/rtld-elf/alpha/lockdflt.c | 9 | ||||
| -rw-r--r-- | libexec/rtld-elf/i386/lockdflt.c | 11 |
2 files changed, 3 insertions, 17 deletions
diff --git a/libexec/rtld-elf/alpha/lockdflt.c b/libexec/rtld-elf/alpha/lockdflt.c index 5847abbb1117..83ab3dc990d7 100644 --- a/libexec/rtld-elf/alpha/lockdflt.c +++ b/libexec/rtld-elf/alpha/lockdflt.c @@ -39,11 +39,6 @@ * contain a count of readers desiring the lock. The algorithm requires * atomic "compare_and_store" and "add" operations, which we implement * using assembly language sequences in "rtld_start.S". - * - * These are spinlocks. When spinning we call nanosleep() for 1 - * microsecond each time around the loop. This will most likely yield - * the CPU to other threads (including, we hope, the lockholder) allowing - * them to make some progress. */ #include <signal.h> @@ -70,7 +65,6 @@ typedef struct Struct_Lock { void *base; } Lock; -static const struct timespec usec = { 0, 1000 }; /* 1 usec. */ static sigset_t fullsigmask, oldsigmask; static void * @@ -118,7 +112,7 @@ rlock_acquire(void *lock) atomic_add_int(&l->lock, RC_INCR); while (l->lock & WAFLAG) - nanosleep(&usec, NULL); + ; /* Spin */ } static void @@ -132,7 +126,6 @@ wlock_acquire(void *lock) if (cmp0_and_store_int(&l->lock, WAFLAG) == 0) break; sigprocmask(SIG_SETMASK, &tmp_oldsigmask, NULL); - nanosleep(&usec, NULL); } oldsigmask = tmp_oldsigmask; } diff --git a/libexec/rtld-elf/i386/lockdflt.c b/libexec/rtld-elf/i386/lockdflt.c index 88dd569131e0..46f8922602b7 100644 --- a/libexec/rtld-elf/i386/lockdflt.c +++ b/libexec/rtld-elf/i386/lockdflt.c @@ -46,11 +46,6 @@ * 80386 we must use simple test-and-set exclusive locks instead. We * determine which kind of lock to use by trying to execute a "cmpxchg" * instruction and catching the SIGILL which results on the 80386. - * - * These are spinlocks. When spinning we call nanosleep() for 1 - * microsecond each time around the loop. This will most likely yield - * the CPU to other threads (including, we hope, the lockholder) allowing - * them to make some progress. */ #include <setjmp.h> @@ -71,7 +66,6 @@ typedef struct Struct_Lock { void *base; } Lock; -static const struct timespec usec = { 0, 1000 }; /* 1 usec. */ static sigset_t fullsigmask, oldsigmask; static inline int @@ -153,7 +147,7 @@ lock80386_acquire(void *lock) break; sigprocmask(SIG_SETMASK, &tmp_oldsigmask, NULL); while (l->lock != 0) - nanosleep(&usec, NULL); + ; /* Spin */ } oldsigmask = tmp_oldsigmask; } @@ -177,7 +171,7 @@ rlock_acquire(void *lock) atomic_add_int(&l->lock, RC_INCR); while (l->lock & WAFLAG) - nanosleep(&usec, NULL); + ; /* Spin */ } static void @@ -191,7 +185,6 @@ wlock_acquire(void *lock) if (cmpxchgl(0, WAFLAG, &l->lock) == 0) break; sigprocmask(SIG_SETMASK, &tmp_oldsigmask, NULL); - nanosleep(&usec, NULL); } oldsigmask = tmp_oldsigmask; } |
