1 // RUN: %clangxx_tsan %s -o %t -framework Foundation -fobjc-arc
2 // RUN: %run %t 2>&1 | FileCheck %s
4 #import <Foundation/Foundation.h>
6 @interface MyClass : NSObject {
9 @property (nonatomic, readonly) long value;
12 dispatch_group_t group;
14 @implementation MyClass
17 dispatch_queue_t q = dispatch_queue_create(NULL, NULL);
18 dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
19 for (int i = 0; i < 1000; i++) {
36 dispatch_group_leave(group);
42 group = dispatch_group_create();
44 for (int j = 0; j < 100; ++j) {
45 dispatch_group_enter(group);
46 MyClass *obj = [[MyClass alloc] init];
52 dispatch_group_wait(group, DISPATCH_TIME_FOREVER);
53 NSLog(@"Hello world");
57 // CHECK-NOT: WARNING: ThreadSanitizer