diff options
Diffstat (limited to 'test/tsan/Darwin/objc-synchronize-nested-recursive.mm')
-rw-r--r-- | test/tsan/Darwin/objc-synchronize-nested-recursive.mm | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/tsan/Darwin/objc-synchronize-nested-recursive.mm b/test/tsan/Darwin/objc-synchronize-nested-recursive.mm new file mode 100644 index 000000000000..ab6643e5c54e --- /dev/null +++ b/test/tsan/Darwin/objc-synchronize-nested-recursive.mm @@ -0,0 +1,35 @@ +// RUN: %clangxx_tsan %s -o %t -framework Foundation -fobjc-arc %darwin_min_target_with_full_runtime_arc_support +// RUN: %run %t 2>&1 | FileCheck %s + +#import <Foundation/Foundation.h> + +int main() { + @autoreleasepool { + NSObject* obj1 = [NSObject new]; + NSObject* obj2 = [NSObject new]; + + @synchronized(obj1) { + @synchronized(obj1) { + NSLog(@"nested 1-1"); +// CHECK: nested 1-1 + } + } + + @synchronized(obj1) { + @synchronized(obj2) { + @synchronized(obj1) { + @synchronized(obj2) { + NSLog(@"nested 1-2-1-2"); +// CHECK: nested 1-2-1-2 + } + } + } + } + + } + + NSLog(@"PASS"); +// CHECK-NOT: ThreadSanitizer +// CHECK: PASS + return 0; +} |