[Lldb-commits] [lldb] [lldb] Fix race/timeout in TestInternalThreadSuspension (PR #203202)

Yao Qi via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 23 05:30:51 PDT 2026


================
@@ -16,7 +17,10 @@ function_to_call() {
 void *
 suspend_func (void *unused) {
   pthread_setname_np("Look for me");
+  pthread_mutex_lock(&signal_mutex);
+  g_signaled = 1;
   pthread_cond_signal(&signal_cond);
+  pthread_mutex_unlock(&signal_mutex);
----------------
qiyao wrote:

`pthread_cond_wait` unlocks mutex on entry and locks mutex on exit.  The mutex unlock above is needed so `pthread_cond_wait`  can acquire the mutex and return.  This is how to guarantee the happen-before relationship.

https://github.com/llvm/llvm-project/pull/203202


More information about the lldb-commits mailing list