1 // Test that thread local data is handled correctly after forking without
2 // exec(). In this test leak checking is initiated from a non-main thread.
3 // RUN: %clangxx_lsan %s -o %t
13 __thread
void *thread_local_var
;
15 void *exit_thread_func(void *arg
) {
19 void ExitFromThread() {
22 res
= pthread_create(&tid
, 0, exit_thread_func
, 0);
29 thread_local_var
= malloc(1337);
33 waitpid(pid
, &status
, 0);
34 assert(WIFEXITED(status
));
35 return WEXITSTATUS(status
);
37 // Spawn a thread and call exit() from there, to check that we track main
38 // thread's pid correctly even if leak checking is initiated from another