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

Unified Diff: webrtc/base/asyncinvoker-inl.h

Issue 2726263004: Fixing race between CallbackCanceled and CancelCallback in AsyncInvoker. (Closed)
Patch Set: 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/asyncinvoker-inl.h
diff --git a/webrtc/base/asyncinvoker-inl.h b/webrtc/base/asyncinvoker-inl.h
index bce68d94d4799caa1030a97ec5bb0034f0f7b8c2..93e7671a9531034e34727a08df593543fbdebbfb 100644
--- a/webrtc/base/asyncinvoker-inl.h
+++ b/webrtc/base/asyncinvoker-inl.h
@@ -18,6 +18,7 @@
#include "webrtc/base/messagehandler.h"
#include "webrtc/base/sigslot.h"
#include "webrtc/base/thread.h"
+#include "webrtc/base/thread_annotations.h"
namespace rtc {
@@ -68,13 +69,16 @@ class NotifyingAsyncClosureBase : public AsyncClosure,
CritScope cs(&crit_);
callback_ = callback;
}
- bool CallbackCanceled() const { return calling_thread_ == nullptr; }
+ bool CallbackCanceled() const {
+ CritScope cs(&crit_);
+ return calling_thread_ == nullptr;
+ }
private:
Location callback_posted_from_;
- Callback0<void> callback_;
CriticalSection crit_;
- Thread* calling_thread_;
+ Callback0<void> callback_ GUARDED_BY(crit_);
+ Thread* calling_thread_ GUARDED_BY(crit_);
void CancelCallback();
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698