1 // Simple stress test for of pthread_create. Increase arg to use as benchmark.
3 // RUN: %clangxx -O3 -pthread %s -o %t && %run %t 1000
5 // Inconsistently fails on Android and can timeout on darwin platforms.
6 // UNSUPPORTED: android, darwin
11 extern "C" const char *__asan_default_options() {
12 // 32bit asan can allocate just a few FakeStacks.
13 return sizeof(void *) < 8 ? "detect_stack_use_after_return=0" : "";
16 static void *null_func(void *args
) { return nullptr; }
18 int main(int argc
, char **argv
) {
19 int n
= atoi(argv
[1]);
20 for (int i
= 0; i
< n
; ++i
) {
22 if (pthread_create(&thread
, 0, null_func
, NULL
) == 0)
23 pthread_detach(thread
);