diff options
| author | Marcus Brinkmann <marcus@gnu.org> | 2004-03-18 02:53:15 +0000 |
|---|---|---|
| committer | Thomas Schwinge <tschwinge@gnu.org> | 2009-04-06 22:29:31 +0200 |
| commit | 3bbee34f0e375e9fd768cc0e59949b0c16849bd5 (patch) | |
| tree | 037da04bf2073d3ad7e019a78b7ff2d647011387 | |
| parent | 87bbfdf3b5718544942498f0d980e13a0f4110da (diff) | |
2004-03-17 Marcus Brinkmann <marcus@gnu.org>
* sysdeps/l4/pt-spin.c (_pthread_spin_lock): Implement using new
time period interface.
| -rw-r--r-- | sysdeps/l4/pt-spin.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/sysdeps/l4/pt-spin.c b/sysdeps/l4/pt-spin.c index 355253ee..d2917d61 100644 --- a/sysdeps/l4/pt-spin.c +++ b/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; } } |
