提交 b8b85a42 编写于 作者: R Rich Felker

optimize contended case for pthread_spin_trylock

上级 c322fe4e
...@@ -2,5 +2,6 @@ ...@@ -2,5 +2,6 @@
int pthread_spin_trylock(pthread_spinlock_t *s) int pthread_spin_trylock(pthread_spinlock_t *s)
{ {
return -a_xchg(s, 1) & EBUSY; if (*s || a_xchg(s, 1)) return EBUSY;
return 0;
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册