]> git.proxmox.com Git - rustc.git/blame - src/compiler-rt/test/tsan/Darwin/gcd-groups-stress.mm
New upstream version 1.12.0+dfsg1
[rustc.git] / src / compiler-rt / test / tsan / Darwin / gcd-groups-stress.mm
CommitLineData
3157f602 1// RUN: %clang_tsan %s -o %t -framework Foundation
5bcae85e 2// RUN: %env_tsan_opts=ignore_interceptors_accesses=1 %run %t 2>&1 | FileCheck %s
3157f602
XL
3
4#import <Foundation/Foundation.h>
5
6void notify_callback(void *context) {
7 // Do nothing.
8}
9
10int main() {
11 NSLog(@"Hello world.");
12
13 dispatch_queue_t q = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
14
15 for (int i = 0; i < 300000; i++) {
16 dispatch_group_t g = dispatch_group_create();
17 dispatch_group_enter(g);
18 dispatch_async(q, ^{
19 dispatch_group_leave(g);
20 });
21 dispatch_group_notify(g, q, ^{
22 // Do nothing.
23 });
24 dispatch_release(g);
25 }
26
27 for (int i = 0; i < 300000; i++) {
28 dispatch_group_t g = dispatch_group_create();
29 dispatch_group_enter(g);
30 dispatch_async(q, ^{
31 dispatch_group_leave(g);
32 });
5bcae85e 33 dispatch_group_notify_f(g, q, NULL, &notify_callback);
3157f602
XL
34 dispatch_release(g);
35 }
36
37 NSLog(@"Done.");
38}
39
40// CHECK: Hello world.
41// CHECK: Done.
42// CHECK-NOT: WARNING: ThreadSanitizer
43// CHECK-NOT: CHECK failed