[PATCH] D18496: [tsan] Fix a crash when exiting the main thread (e.g. dispatch_main)

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 27 07:34:17 PDT 2016


dvyukov added inline comments.

================
Comment at: test/tsan/Darwin/dispatch_main.mm:28
@@ +27,3 @@
+      sleep(3);
+      exit(0);
+    });
----------------
kubabrecka wrote:
> dvyukov wrote:
> > This is exit which should terminate whole process. How is calling pthread_exit? Where? 
> pthread_exit is called immediately from dispatch_main below, not here.
I am confused. You do "// CHECK: Done.", so NSLog is executed. But then exit is not executed? And this is executed on the main thread? How does dispatch_main calls pthread_exit while we are blocked in sleep in the very same thread? From a signal handler? Why does it do it?
I seem to be missing something.


http://reviews.llvm.org/D18496





More information about the llvm-commits mailing list