[tsan] Fix hanging gcd-apply and gcd-apply-race tests on macOS Sierra

llvm-svn: 281462
This commit is contained in:
Kuba Brecka
2016-09-14 13:53:06 +00:00
parent 697026f312
commit 896bbb3dfe
2 changed files with 8 additions and 0 deletions

View File

@@ -10,6 +10,10 @@ long global;
int main(int argc, const char *argv[]) {
barrier_init(&barrier, 2);
fprintf(stderr, "start\n");
// Warm up GCD (workaround for macOS Sierra where dispatch_apply might run single-threaded).
dispatch_sync(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ });
dispatch_queue_t q = dispatch_queue_create("my.queue", DISPATCH_QUEUE_CONCURRENT);
dispatch_apply(2, q, ^(size_t i) {
global = i;

View File

@@ -17,6 +17,10 @@ void callback(void *context, size_t i) {
int main(int argc, const char *argv[]) {
barrier_init(&barrier, 2);
fprintf(stderr, "start\n");
// Warm up GCD (workaround for macOS Sierra where dispatch_apply might run single-threaded).
dispatch_sync(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ });
dispatch_queue_t q = dispatch_queue_create("my.queue", DISPATCH_QUEUE_CONCURRENT);
global = 42;