36 lines · plain
1// RUN: %clangxx_tsan %s -o %t -framework Foundation -fobjc-arc2// RUN: %run %t 2>&1 | FileCheck %s3 4#import <Foundation/Foundation.h>5 6int main() {7 @autoreleasepool {8 NSObject* obj1 = [NSObject new];9 NSObject* obj2 = [NSObject new];10 11 @synchronized(obj1) {12 @synchronized(obj1) {13 NSLog(@"nested 1-1");14// CHECK: nested 1-115 }16 }17 18 @synchronized(obj1) {19 @synchronized(obj2) {20 @synchronized(obj1) {21 @synchronized(obj2) {22 NSLog(@"nested 1-2-1-2");23// CHECK: nested 1-2-1-224 }25 }26 }27 }28 29 }30 31 NSLog(@"PASS");32// CHECK-NOT: ThreadSanitizer33// CHECK: PASS34 return 0;35}36