1 // RUN: %clang_tsan %s -o %t -framework Foundation
2 // RUN: %env_tsan_opts=ignore_interceptors_accesses=1 %run %t 2>&1 | FileCheck %s
4 #import <Foundation/Foundation.h>
8 void handler(void *arg) {
9 fprintf(stderr, "global = %ld\n", global);
11 dispatch_sync(dispatch_get_main_queue(), ^{
12 CFRunLoopStop(CFRunLoopGetCurrent());
16 int main(int argc, const char *argv[]) {
17 dispatch_queue_t queue =
18 dispatch_queue_create("my.queue", DISPATCH_QUEUE_CONCURRENT);
20 dispatch_source_t source =
21 dispatch_source_create(DISPATCH_SOURCE_TYPE_SIGNAL, SIGHUP, 0, queue);
25 dispatch_source_set_registration_handler_f(source, handler);
27 dispatch_resume(source);
35 // CHECK-NOT: WARNING: ThreadSanitizer