[Lldb-commits] [PATCH] Thread deadlock and termination.

Stephen Wilson wilsons at start.ca
Thu Jul 22 21:26:10 PDT 2010


The attached communication.patch removes a premature invalidation of a
threads pthread_t handle, thus avoiding a segfault when calling
pthread_cancel.  Also, sets m_read_thread_enabled iff the thread is
actually spawned.

In host.patch a deadlock condition is removed.  A bit of explanation is
needed: When calling ThreadCancel in Host::WillTerminate
g_monitor_thread may be blocked on a call to pthread_cond_wait (for
example, line 640).  Now, by default, when a cancellation request is
serviced g_monitor_thread will again own the mutex guarding the
condition variable it was waiting on.  This causes the call to SetValue
in Host::WillTerminate to hit a deadlock.

The call to SetValue does not appear to be needed, so removing it solves
the issue.

Note that the above is in the linux side of the code.  I see similar
code in source/Host/macosx/Host.mm but am not sure if it is an issue
there as well.


Thanks,
Steve


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: communication.patch
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20100723/84ead8a6/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: host.patch
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20100723/84ead8a6/attachment-0001.ksh>


More information about the lldb-commits mailing list