diff options
author | marcus <marcus> | 2004-03-18 02:53:15 +0000 |
---|---|---|
committer | marcus <marcus> | 2004-03-18 02:53:15 +0000 |
commit | 7287321326eeda04e909c844aa01668c03418f8d (patch) | |
tree | e0ed826ab6a3a42a6c74f935a1e015233f4491ab /libpthread/sysdeps | |
parent | c55b186ce317f62193803c9bb607e8f882e4c3f4 (diff) |
2004-03-17 Marcus Brinkmann <marcus@gnu.org>
* sysdeps/l4/pt-spin.c (_pthread_spin_lock): Implement using new
time period interface.
Diffstat (limited to 'libpthread/sysdeps')
-rw-r--r-- | libpthread/sysdeps/l4/pt-spin.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/libpthread/sysdeps/l4/pt-spin.c b/libpthread/sysdeps/l4/pt-spin.c index 355253e..d2917d6 100644 --- a/libpthread/sysdeps/l4/pt-spin.c +++ b/libpthread/sysdeps/l4/pt-spin.c @@ -40,9 +40,10 @@ _pthread_spin_lock (__pthread_spinlock_t *lock) { l4_time_t timeout; int i; - - timeout.period.m = 1; - timeout.period.e = 1; + + /* Start with a small timeout of 2 microseconds, then back off + exponentially. */ + timeout = l4_time_period (2); while (1) { @@ -51,9 +52,11 @@ _pthread_spin_lock (__pthread_spinlock_t *lock) if (__pthread_spin_trylock (lock) == 0) return 0; } - /* FIXME verify this */ - l4_receive_timeout (l4_nilthread, timeout); - timeout.period.e++; + l4_sleep (timeout); + + timeout = l4_time_mul2 (timeout); + if (timeout == L4_NEVER) + timeout = L4_TIME_PERIOD_MAX; } } |