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:
b8dda24
)
optimize spin lock not to dirty cache line while spinning
author
Rich Felker
<dalias@aerifal.cx>
Wed, 22 Apr 2015 07:16:50 +0000
(
03:16
-0400)
committer
Rich Felker
<dalias@aerifal.cx>
Wed, 22 Apr 2015 07:16:50 +0000
(
03:16
-0400)
src/thread/pthread_spin_lock.c
patch
|
blob
|
history
diff --git
a/src/thread/pthread_spin_lock.c
b/src/thread/pthread_spin_lock.c
index df575f0858681b76afb8895478778b67e8ca2a7b..0462e0f3a4004ca469cf6f99f7c24566f383a423 100644
(file)
--- 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_swap(s
, 1)) a_spin();
+ while (
*(volatile int *)s || a_cas(s, 0
, 1)) a_spin();
return 0;
}