Browse Source

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. :^)
Andreas Kling 5 years ago
parent
commit
e7dfd40dc3
1 changed files with 1 additions and 1 deletions
  1. 1 1
      Libraries/LibPthread/pthread.cpp

+ 1 - 1
Libraries/LibPthread/pthread.cpp

@@ -388,7 +388,7 @@ int pthread_setschedparam(pthread_t thread, int policy, const struct sched_param
 }
 
 struct WaitNode : public InlineLinkedListNode<WaitNode> {
-    bool waiting { true };
+    volatile bool waiting { true };
     WaitNode* m_next { nullptr };
     WaitNode* m_prev { nullptr };
 };