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

Kuba Brecka via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 27 07:39:02 PDT 2016


kubabrecka added inline comments.

================
Comment at: test/tsan/Darwin/dispatch_main.mm:28
@@ +27,3 @@
+      sleep(3);
+      exit(0);
+    });
----------------
dvyukov wrote:
> 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.
This is not executed on the main thread, the main thread is terminated from dispatch_main.  This gets executed on a different thread, but technically still on the "main queue".


http://reviews.llvm.org/D18496





More information about the llvm-commits mailing list