浏览代码

optimize spinlock spin

Rich Felker 14 年之前
父节点
当前提交
c322fe4e1a
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/thread/pthread_spin_lock.c

+ 1 - 1
src/thread/pthread_spin_lock.c

@@ -2,6 +2,6 @@
 
 int pthread_spin_lock(pthread_spinlock_t *s)
 {
-	while (a_xchg(s, 1));
+	while (*s || a_xchg(s, 1));
 	return 0;
 }