mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 03:27:39 +00:00
Use exponential backoff in mutexes
This commit is contained in:
parent
a0ddb889da
commit
7b34f32fc4
2 changed files with 3 additions and 2 deletions
|
@ -29,7 +29,8 @@
|
|||
* @return 0 on success, or error number on failure
|
||||
*/
|
||||
int pthread_mutex_lock(pthread_mutex_t *mutex) {
|
||||
int i, me, owner, tries;
|
||||
volatile int i;
|
||||
int me, owner, tries;
|
||||
for (tries = 0, me = gettid();;) {
|
||||
owner = atomic_load_explicit(&mutex->lock, memory_order_relaxed);
|
||||
if (!owner && atomic_compare_exchange_weak_explicit(
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
.include "o/libc/sysv/macros.internal.inc"
|
||||
.scall sys_sched_yield,0x15e12a14b103c018,globl,hidden
|
||||
.scall sys_sched_yield,0x15e12a14bffff018,globl,hidden
|
||||
|
|
Loading…
Reference in a new issue