From e7dfd40dc37ddf8779cbcdf2afa54da89b4776d0 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 7 Dec 2019 15:34:00 +0100 Subject: [PATCH] LibPthread: Mark the pthread_cond_t "waiting" flag as volatile Oops, this is not gonna work if the compiler can optimize out all the reads from this flag. :^) --- Libraries/LibPthread/pthread.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/LibPthread/pthread.cpp b/Libraries/LibPthread/pthread.cpp index 8e553b59ae..246e2abdc5 100644 --- a/Libraries/LibPthread/pthread.cpp +++ b/Libraries/LibPthread/pthread.cpp @@ -388,7 +388,7 @@ int pthread_setschedparam(pthread_t thread, int policy, const struct sched_param } struct WaitNode : public InlineLinkedListNode { - bool waiting { true }; + volatile bool waiting { true }; WaitNode* m_next { nullptr }; WaitNode* m_prev { nullptr }; };