diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/stdio/__lockfile.c | 2 | ||||
| -rw-r--r-- | src/thread/pthread_spin_lock.c | 2 | ||||
| -rw-r--r-- | src/thread/pthread_spin_trylock.c | 3 | 
3 files changed, 3 insertions, 4 deletions
| diff --git a/src/stdio/__lockfile.c b/src/stdio/__lockfile.c index 93c94867..c0948255 100644 --- a/src/stdio/__lockfile.c +++ b/src/stdio/__lockfile.c @@ -13,7 +13,7 @@ void __lockfile(FILE *f)  		f->lockcount++;  		return;  	} -	while (f->lock || a_cas(&f->lock, 0, tid)) +	while (a_cas(&f->lock, 0, tid))  		if (spins) spins--, a_spin();  		else syscall(SYS_sched_yield);  	f->lockcount = 1; diff --git a/src/thread/pthread_spin_lock.c b/src/thread/pthread_spin_lock.c index 59fa6ea8..0ab3d64f 100644 --- a/src/thread/pthread_spin_lock.c +++ b/src/thread/pthread_spin_lock.c @@ -2,6 +2,6 @@  int pthread_spin_lock(pthread_spinlock_t *s)  { -	while (a_xchg(s, 1)); +	while (a_xchg(s, 1)) a_spin();  	return 0;  } diff --git a/src/thread/pthread_spin_trylock.c b/src/thread/pthread_spin_trylock.c index 1fc5f73c..c12696b3 100644 --- a/src/thread/pthread_spin_trylock.c +++ b/src/thread/pthread_spin_trylock.c @@ -2,6 +2,5 @@  int pthread_spin_trylock(pthread_spinlock_t *s)  { -	if (*s || a_xchg(s, 1)) return EBUSY; -	return 0; +	return -a_xchg(s, 1) & EBUSY;  } | 
