Index: webrtc/base/messagequeue.h |
diff --git a/webrtc/base/messagequeue.h b/webrtc/base/messagequeue.h |
index a7991a8923ad407c216c63542445077df50d2896..efc479cf2644243d8abff92dcfe414e43055d97b 100644 |
--- a/webrtc/base/messagequeue.h |
+++ b/webrtc/base/messagequeue.h |
@@ -24,9 +24,11 @@ |
#include "webrtc/base/messagehandler.h" |
#include "webrtc/base/scoped_ptr.h" |
#include "webrtc/base/scoped_ref_ptr.h" |
+#include "webrtc/base/sharedexclusivelock.h" |
#include "webrtc/base/sigslot.h" |
#include "webrtc/base/socketserver.h" |
#include "webrtc/base/timeutils.h" |
+#include "webrtc/base/thread_annotations.h" |
namespace rtc { |
@@ -181,7 +183,7 @@ class MessageQueue { |
// calling Clear on the object from a different thread. |
virtual ~MessageQueue(); |
- SocketServer* socketserver() { return ss_; } |
+ SocketServer* socketserver(); |
void set_socketserver(SocketServer* ss); |
// Note: The behavior of MessageQueue has changed. When a MQ is stopped, |
@@ -260,21 +262,25 @@ class MessageQueue { |
// destructor. |
void DoDestroy(); |
- // The SocketServer is not owned by MessageQueue. |
- SocketServer* ss_; |
- // If a server isn't supplied in the constructor, use this one. |
- scoped_ptr<SocketServer> default_ss_; |
+ void WakeUpSocketServer(); |
+ |
bool fStop_; |
bool fPeekKeep_; |
Message msgPeek_; |
- MessageList msgq_; |
- PriorityQueue dmsgq_; |
- uint32_t dmsgq_next_num_; |
+ MessageList msgq_ GUARDED_BY(crit_); |
+ PriorityQueue dmsgq_ GUARDED_BY(crit_); |
+ uint32_t dmsgq_next_num_ GUARDED_BY(crit_); |
CriticalSection crit_; |
bool fInitialized_; |
bool fDestroyed_; |
private: |
+ // The SocketServer is not owned by MessageQueue. |
+ SocketServer* ss_ GUARDED_BY(ss_lock_); |
+ // If a server isn't supplied in the constructor, use this one. |
+ scoped_ptr<SocketServer> default_ss_; |
+ SharedExclusiveLock ss_lock_; |
+ |
RTC_DISALLOW_COPY_AND_ASSIGN(MessageQueue); |
}; |