[tsan] Replace pthread_yield with sched_yield in lit tests
OS X doesn't have `pthread_yield`. Let's use `sched_yield` instead. Differential Revision: http://reviews.llvm.org/D14428 llvm-svn: 252283
This commit is contained in:
parent
e6f87ca812
commit
1ef2414861
|
|
@ -13,7 +13,7 @@ int main() {
|
|||
pthread_t t;
|
||||
pthread_create(&t, 0, Thread, a);
|
||||
while (__atomic_load_n(a, __ATOMIC_RELAXED) == 0)
|
||||
pthread_yield();
|
||||
sched_yield();
|
||||
delete a;
|
||||
pthread_join(t, 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ void *Thread(void *seed) {
|
|||
for (;;) {
|
||||
int old = __atomic_load_n(&m->state, __ATOMIC_RELAXED);
|
||||
if (old == kStateLocked) {
|
||||
pthread_yield();
|
||||
sched_yield();
|
||||
continue;
|
||||
}
|
||||
int newv = old + 1;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ static __attribute__((noinline)) void loop() {
|
|||
volatile char *p = (char*)malloc(1);
|
||||
p[0] = 0;
|
||||
free((void*)p);
|
||||
pthread_yield();
|
||||
sched_yield();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue