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

Side by Side Diff: webrtc/base/platform_thread.h

Issue 2708433002: Replace the stop_event_ in PlatformThread with an atomic flag (Closed)
Patch Set: Update ProcessThreadImpl tests to not always return 0. Guessing it may be causing bot problems 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 unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/base/platform_thread.cc » ('j') | webrtc/base/platform_thread.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 87
88 ThreadRunFunction const run_function_; 88 ThreadRunFunction const run_function_;
89 void* const obj_; 89 void* const obj_;
90 // TODO(pbos): Make sure call sites use string literals and update to a const 90 // TODO(pbos): Make sure call sites use string literals and update to a const
91 // char* instead of a std::string. 91 // char* instead of a std::string.
92 const std::string name_; 92 const std::string name_;
93 rtc::ThreadChecker thread_checker_; 93 rtc::ThreadChecker thread_checker_;
94 #if defined(WEBRTC_WIN) 94 #if defined(WEBRTC_WIN)
95 static DWORD WINAPI StartThread(void* param); 95 static DWORD WINAPI StartThread(void* param);
96 96
97 bool stop_; 97 bool stop_ = false;
98 HANDLE thread_; 98 HANDLE thread_ = nullptr;
99 DWORD thread_id_; 99 DWORD thread_id_ = 0;
100 #else 100 #else
101 static void* StartThread(void* param); 101 static void* StartThread(void* param);
102 102
103 rtc::Event stop_event_; 103 // An atomic flag that we use to stop the thread. Only modified on the
104 104 // controlling thread and checked on the worker thread.
105 pthread_t thread_; 105 volatile int stop_flag_ = 0;
106 pthread_t thread_ = 0;
106 #endif // defined(WEBRTC_WIN) 107 #endif // defined(WEBRTC_WIN)
107 RTC_DISALLOW_COPY_AND_ASSIGN(PlatformThread); 108 RTC_DISALLOW_COPY_AND_ASSIGN(PlatformThread);
108 }; 109 };
109 110
110 } // namespace rtc 111 } // namespace rtc
111 112
112 #endif // WEBRTC_BASE_PLATFORM_THREAD_H_ 113 #endif // WEBRTC_BASE_PLATFORM_THREAD_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/base/platform_thread.cc » ('j') | webrtc/base/platform_thread.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698