Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(566)

Unified Diff: webrtc/base/platform_thread.h

Issue 2708433002: Replace the stop_event_ in PlatformThread with an atomic flag (Closed)
Patch Set: Now hitting 'save' before committing the TODO Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/base/platform_thread.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/platform_thread.h
diff --git a/webrtc/base/platform_thread.h b/webrtc/base/platform_thread.h
index d74aec2811410e9533eaab8bcf86d854d98feab5..667407fabc4299b034ae7ad0203044ba6caecf89 100644
--- a/webrtc/base/platform_thread.h
+++ b/webrtc/base/platform_thread.h
@@ -94,15 +94,16 @@ class PlatformThread {
#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);
};
« no previous file with comments | « no previous file | webrtc/base/platform_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698