OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 | 202 |
203 // Note: The behavior of MessageQueue has changed. When a MQ is stopped, | 203 // Note: The behavior of MessageQueue has changed. When a MQ is stopped, |
204 // futher Posts and Sends will fail. However, any pending Sends and *ready* | 204 // futher Posts and Sends will fail. However, any pending Sends and *ready* |
205 // Posts (as opposed to unexpired delayed Posts) will be delivered before | 205 // Posts (as opposed to unexpired delayed Posts) will be delivered before |
206 // Get (or Peek) returns false. By guaranteeing delivery of those messages, | 206 // Get (or Peek) returns false. By guaranteeing delivery of those messages, |
207 // we eliminate the race condition when an MessageHandler and MessageQueue | 207 // we eliminate the race condition when an MessageHandler and MessageQueue |
208 // may be destroyed independently of each other. | 208 // may be destroyed independently of each other. |
209 virtual void Quit(); | 209 virtual void Quit(); |
210 virtual bool IsQuitting(); | 210 virtual bool IsQuitting(); |
211 virtual void Restart(); | 211 virtual void Restart(); |
| 212 // Not all message queues actually process messages (such as SignalThread). |
| 213 // In those cases, it's important to know, before posting, that it won't be |
| 214 // Processed. Normally, this would be true until IsQuitting() is true. |
| 215 virtual bool IsProcessingMessages(); |
212 | 216 |
213 // Get() will process I/O until: | 217 // Get() will process I/O until: |
214 // 1) A message is available (returns true) | 218 // 1) A message is available (returns true) |
215 // 2) cmsWait seconds have elapsed (returns false) | 219 // 2) cmsWait seconds have elapsed (returns false) |
216 // 3) Stop() is called (returns false) | 220 // 3) Stop() is called (returns false) |
217 virtual bool Get(Message *pmsg, int cmsWait = kForever, | 221 virtual bool Get(Message *pmsg, int cmsWait = kForever, |
218 bool process_io = true); | 222 bool process_io = true); |
219 virtual bool Peek(Message *pmsg, int cmsWait = 0); | 223 virtual bool Peek(Message *pmsg, int cmsWait = 0); |
220 virtual void Post(const Location& posted_from, | 224 virtual void Post(const Location& posted_from, |
221 MessageHandler* phandler, | 225 MessageHandler* phandler, |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 // Used if SocketServer ownership lies with |this|. | 309 // Used if SocketServer ownership lies with |this|. |
306 std::unique_ptr<SocketServer> own_ss_; | 310 std::unique_ptr<SocketServer> own_ss_; |
307 SharedExclusiveLock ss_lock_; | 311 SharedExclusiveLock ss_lock_; |
308 | 312 |
309 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MessageQueue); | 313 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MessageQueue); |
310 }; | 314 }; |
311 | 315 |
312 } // namespace rtc | 316 } // namespace rtc |
313 | 317 |
314 #endif // WEBRTC_BASE_MESSAGEQUEUE_H_ | 318 #endif // WEBRTC_BASE_MESSAGEQUEUE_H_ |
OLD | NEW |