[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:
Kuba Brecka 2015-11-06 11:05:53 +00:00
parent e6f87ca812
commit 1ef2414861
3 changed files with 3 additions and 3 deletions

View File

@ -13,7 +13,7 @@ int main() {
pthread_t t; pthread_t t;
pthread_create(&t, 0, Thread, a); pthread_create(&t, 0, Thread, a);
while (__atomic_load_n(a, __ATOMIC_RELAXED) == 0) while (__atomic_load_n(a, __ATOMIC_RELAXED) == 0)
pthread_yield(); sched_yield();
delete a; delete a;
pthread_join(t, 0); pthread_join(t, 0);
} }

View File

@ -59,7 +59,7 @@ void *Thread(void *seed) {
for (;;) { for (;;) {
int old = __atomic_load_n(&m->state, __ATOMIC_RELAXED); int old = __atomic_load_n(&m->state, __ATOMIC_RELAXED);
if (old == kStateLocked) { if (old == kStateLocked) {
pthread_yield(); sched_yield();
continue; continue;
} }
int newv = old + 1; int newv = old + 1;

View File

@ -24,7 +24,7 @@ static __attribute__((noinline)) void loop() {
volatile char *p = (char*)malloc(1); volatile char *p = (char*)malloc(1);
p[0] = 0; p[0] = 0;
free((void*)p); free((void*)p);
pthread_yield(); sched_yield();
} }
} }