Revert "[lldb][test] Remove compiler version check and use regex" (#124101)
[llvm-project.git] / compiler-rt / test / tsan / libdispatch / groups-stress.c
blob0f24ff7c954e6892d79c764e58f95f783244c273
1 // RUN: %clang_tsan %s -o %t
2 // RUN: %run %t 2>&1 | FileCheck %s --implicit-check-not='ThreadSanitizer'
4 #include <dispatch/dispatch.h>
6 #include <stdio.h>
8 void notify_callback(void *context) {
9 // Do nothing.
12 int main() {
13 fprintf(stderr, "Hello world.");
15 dispatch_queue_t q = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
17 for (int i = 0; i < 300000; i++) {
18 dispatch_group_t g = dispatch_group_create();
19 dispatch_group_enter(g);
20 dispatch_async(q, ^{
21 dispatch_group_leave(g);
22 });
23 dispatch_group_notify(g, q, ^{
24 // Do nothing.
25 });
26 dispatch_release(g);
29 for (int i = 0; i < 300000; i++) {
30 dispatch_group_t g = dispatch_group_create();
31 dispatch_group_enter(g);
32 dispatch_async(q, ^{
33 dispatch_group_leave(g);
34 });
35 dispatch_group_notify_f(g, q, NULL, &notify_callback);
36 dispatch_release(g);
39 fprintf(stderr, "Done.");
42 // CHECK: Hello world.
43 // CHECK: Done.