Replace the stop_event_ in PlatformThread with an atomic flag

BUG=webrtc:7187

Review-Url: https://codereview.webrtc.org/2708433002
Cr-Commit-Position: refs/heads/master@{#16705}
diff --git a/webrtc/base/platform_thread.h b/webrtc/base/platform_thread.h
index d74aec2..667407f 100644
--- a/webrtc/base/platform_thread.h
+++ b/webrtc/base/platform_thread.h
@@ -94,15 +94,16 @@
 #if defined(WEBRTC_WIN)
   static DWORD WINAPI StartThread(void* param);
 
-  bool stop_;
-  HANDLE thread_;
-  DWORD thread_id_;
+  bool stop_ = false;
+  HANDLE thread_ = nullptr;
+  DWORD thread_id_ = 0;
 #else
   static void* StartThread(void* param);
 
-  rtc::Event stop_event_;
-
-  pthread_t thread_;
+  // An atomic flag that we use to stop the thread. Only modified on the
+  // controlling thread and checked on the worker thread.
+  volatile int stop_flag_ = 0;
+  pthread_t thread_ = 0;
 #endif  // defined(WEBRTC_WIN)
   RTC_DISALLOW_COPY_AND_ASSIGN(PlatformThread);
 };