From fedf87591de7592a2f85fa52e65d5dd8cd2126f8 Mon Sep 17 00:00:00 2001
From: Edric Milaret <edric.ladent-milaret@savoirfairelinux.com>
Date: Fri, 29 Jan 2016 11:22:51 -0500
Subject: [PATCH] windows: fix race conditions in threadloop

- It seems like we sometimes call joinable() too
soon, it return false and then it interrupt ffmpeg
- It happens regurlarly when we don't launch the Windows
Ring client without console
- This will need further investigation to determine if it's
a more profound issue or if it could theoretically affect
other platforms (even if we never constated it yet)

No bugs have been constated from not checking the joinable in
isRunning after 35 calls

Change-Id: I0968d9cfe401511c37231dc7defb4b3d74a77453
Tuleap: #303
---
 src/threadloop.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/threadloop.cpp b/src/threadloop.cpp
index 140f1deccb..f574a2020d 100644
--- a/src/threadloop.cpp
+++ b/src/threadloop.cpp
@@ -117,7 +117,11 @@ void ThreadLoop::exit()
 bool
 ThreadLoop::isRunning() const noexcept
 {
+#ifdef _WIN32
+    return state_ == RUNNING;
+#else
     return thread_.joinable() and state_ == RUNNING;
+#endif
 }
 
 bool
-- 
GitLab