1 // RUN: %clangxx_tsan %s -o %t -framework Foundation
2 // RUN: %run %t 2>&1 | FileCheck %s
4 #import <Foundation/Foundation.h>
21 int main(int argc, const char *argv[]) {
22 fprintf(stderr, "Hello world.\n");
23 print_address("addr=", 1, &my_global);
24 barrier_init(&barrier, 2);
26 std::shared_ptr<MyStruct> shared(new MyStruct());
28 dispatch_queue_t q = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
30 std::weak_ptr<MyStruct> weak(shared);
34 std::shared_ptr<MyStruct> strong = weak.lock();
39 barrier_wait(&barrier);
42 barrier_wait(&barrier);
45 fprintf(stderr, "Done.\n");
48 // CHECK: Hello world.
50 // CHECK-NOT: WARNING: ThreadSanitizer