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

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

Issue 2885143006: Fixing potential AsyncInvoker deadlock that occurs for "reentrant" invocations. (Closed)
Patch Set: Addressing TSan race warning Created 3 years, 7 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/asyncinvoker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2014 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 Thread* thread, 113 Thread* thread,
114 std::unique_ptr<AsyncClosure> closure, 114 std::unique_ptr<AsyncClosure> closure,
115 uint32_t id); 115 uint32_t id);
116 void DoInvokeDelayed(const Location& posted_from, 116 void DoInvokeDelayed(const Location& posted_from,
117 Thread* thread, 117 Thread* thread,
118 std::unique_ptr<AsyncClosure> closure, 118 std::unique_ptr<AsyncClosure> closure,
119 uint32_t delay_ms, 119 uint32_t delay_ms,
120 uint32_t id); 120 uint32_t id);
121 volatile int pending_invocations_ = 0; 121 volatile int pending_invocations_ = 0;
122 Event invocation_complete_; 122 Event invocation_complete_;
123 bool destroying_ = false; 123 int destroying_ = 0;
124 friend class AsyncClosure; 124 friend class AsyncClosure;
125 125
126 RTC_DISALLOW_COPY_AND_ASSIGN(AsyncInvoker); 126 RTC_DISALLOW_COPY_AND_ASSIGN(AsyncInvoker);
127 }; 127 };
128 128
129 // Similar to AsyncInvoker, but guards against the Thread being destroyed while 129 // Similar to AsyncInvoker, but guards against the Thread being destroyed while
130 // there are outstanding dangling pointers to it. It will connect to the current 130 // there are outstanding dangling pointers to it. It will connect to the current
131 // thread in the constructor, and will get notified when that thread is 131 // thread in the constructor, and will get notified when that thread is
132 // destroyed. After GuardedAsyncInvoker is constructed, it can be used from 132 // destroyed. After GuardedAsyncInvoker is constructed, it can be used from
133 // other threads to post functors to the thread it was constructed on. If that 133 // other threads to post functors to the thread it was constructed on. If that
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 void ThreadDestroyed(); 212 void ThreadDestroyed();
213 213
214 CriticalSection crit_; 214 CriticalSection crit_;
215 Thread* thread_ GUARDED_BY(crit_); 215 Thread* thread_ GUARDED_BY(crit_);
216 AsyncInvoker invoker_ GUARDED_BY(crit_); 216 AsyncInvoker invoker_ GUARDED_BY(crit_);
217 }; 217 };
218 218
219 } // namespace rtc 219 } // namespace rtc
220 220
221 #endif // WEBRTC_BASE_ASYNCINVOKER_H_ 221 #endif // WEBRTC_BASE_ASYNCINVOKER_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/base/asyncinvoker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698