[Lldb-commits] [PATCH] Prevent deadlock on thread termination

Tim Northover tnorthover at apple.com
Tue Jun 25 12:41:51 PDT 2013


Hi,

LLDB often segfaults when exiting on my version of Linux. I eventually tracked 
this down to the m_read_thread variable being set to 0 during the execution of 
Communication::StopReadThread, causing an invalid pthread_join call (with 0 
thread id).

I think the only two threads involved are the stopper and the read thread 
itself, which also sets m_read_thread to 0. The attached patch leaves all such 
changes to StopReadThread and fixes the issue on my machine.

What I'm not sure of are the consequences if the thread exits naturally. It 
looks like you'll get an error one way or the other from trying to read 
anyway, but I'm new to the code so could be wrong.

Should I commit?

Cheers.

Tim.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stop-read-thread-deadlock.diff
Type: text/x-patch
Size: 657 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20130625/b06d57e9/attachment.bin>


More information about the lldb-commits mailing list