1 // RUN: %clangxx_tsan %s -o %t -framework Foundation -std=c++11
2 // RUN: %run %t 2>&1 | FileCheck %s
4 #import <Foundation/Foundation.h>
5 #import <libkern/OSAtomic.h>
18 int main(int argc, const char *argv[]) {
19 barrier_init(&barrier, 2);
22 ListItem *li = new ListItem{nullptr, 42};
23 OSAtomicEnqueue(&q, li, 0);
24 barrier_wait(&barrier);
28 barrier_wait(&barrier);
29 ListItem *li = (ListItem *)OSAtomicDequeue(&q, 0);
30 fprintf(stderr, "data = %ld\n", li->data);
36 fprintf(stderr, "done\n");
43 // CHECK-NOT: WARNING: ThreadSanitizer