projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c322fe4
)
optimize contended case for pthread_spin_trylock
author
Rich Felker
<dalias@aerifal.cx>
Fri, 25 Mar 2011 03:06:08 +0000
(23:06 -0400)
committer
Rich Felker
<dalias@aerifal.cx>
Fri, 25 Mar 2011 03:06:08 +0000
(23:06 -0400)
src/thread/pthread_spin_trylock.c
patch
|
blob
|
history
diff --git
a/src/thread/pthread_spin_trylock.c
b/src/thread/pthread_spin_trylock.c
index c12696b3010b332706d203faa7e16cad62433bca..1fc5f73c174ec890da1457bb8bd776f9e1fb3bc2 100644
(file)
--- a/
src/thread/pthread_spin_trylock.c
+++ b/
src/thread/pthread_spin_trylock.c
@@
-2,5
+2,6
@@
int pthread_spin_trylock(pthread_spinlock_t *s)
{
- return -a_xchg(s, 1) & EBUSY;
+ if (*s || a_xchg(s, 1)) return EBUSY;
+ return 0;
}