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

Unified Diff: webrtc/base/task_queue.h

Issue 2706923005: Showing alternative approach to fixing TaskQueue deadlock. (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 | webrtc/base/task_queue_libevent.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/task_queue.h
diff --git a/webrtc/base/task_queue.h b/webrtc/base/task_queue.h
index a6a70364ac4a19df27e28a2580efdeca6568f393..d0c313f5712c37de342785ec84c4d8239aa5ce8f 100644
--- a/webrtc/base/task_queue.h
+++ b/webrtc/base/task_queue.h
@@ -27,6 +27,8 @@
#endif
#if defined(WEBRTC_BUILD_LIBEVENT)
+#include "webrtc/base/refcountedobject.h"
+#include "webrtc/base/scoped_ref_ptr.h"
struct event_base;
struct event;
#endif
@@ -238,10 +240,12 @@ class LOCKABLE TaskQueue {
static void RunTimer(int fd, short flags, void* context); // NOLINT
class PostAndReplyTask;
+ class PostAndReplyTaskRefOwner;
class SetTimerTask;
+ typedef RefCountedObject<PostAndReplyTask> PostAndReplyTaskRef;
- void PrepareReplyTask(PostAndReplyTask* reply_task);
- void ReplyTaskDone(PostAndReplyTask* reply_task);
+ void PrepareReplyTask(scoped_refptr<PostAndReplyTaskRef> reply_task);
+ void PostAndReplyTaskDone(PostAndReplyTask* reply_task);
struct QueueContext;
@@ -252,7 +256,9 @@ class LOCKABLE TaskQueue {
PlatformThread thread_;
rtc::CriticalSection pending_lock_;
std::list<std::unique_ptr<QueuedTask>> pending_ GUARDED_BY(pending_lock_);
- std::list<PostAndReplyTask*> pending_replies_ GUARDED_BY(pending_lock_);
+ std::list<scoped_refptr<PostAndReplyTaskRef>> pending_replies_
+ GUARDED_BY(pending_lock_);
+ volatile bool destroying_ = false;
#elif defined(WEBRTC_MAC)
struct QueueContext;
struct TaskContext;
« no previous file with comments | « no previous file | webrtc/base/task_queue_libevent.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698