summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Brinkmann <marcus@gnu.org>2004-03-18 02:53:15 +0000
committerThomas Schwinge <tschwinge@gnu.org>2009-04-06 22:29:31 +0200
commitaf019b5030106663bb4afcefdca9a304ea063f31 (patch)
treea266c0419116304ed39aa7e9934a05f2af703f13
parentef01119ea9239c3e91c33dc3b51bb059eb621677 (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--ChangeLog5
-rw-r--r--sysdeps/l4/pt-spin.c15
2 files changed, 14 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 79655f3..185daee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-03-17 Marcus Brinkmann <marcus@gnu.org>
+
+ * sysdeps/l4/pt-spin.c (_pthread_spin_lock): Implement using new
+ time period interface.
+
2003-10-16 Johan Rydberg <jrydberg@night.trouble.net>
Many changes throughout all files, converting L4 specific source
diff --git a/sysdeps/l4/pt-spin.c b/sysdeps/l4/pt-spin.c
index 355253e..d2917d6 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;
}
}