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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 protected: | 94 protected: |
95 Runnable() {} | 95 Runnable() {} |
96 | 96 |
97 private: | 97 private: |
98 RTC_DISALLOW_COPY_AND_ASSIGN(Runnable); | 98 RTC_DISALLOW_COPY_AND_ASSIGN(Runnable); |
99 }; | 99 }; |
100 | 100 |
101 // WARNING! SUBCLASSES MUST CALL Stop() IN THEIR DESTRUCTORS! See ~Thread(). | 101 // WARNING! SUBCLASSES MUST CALL Stop() IN THEIR DESTRUCTORS! See ~Thread(). |
102 | 102 |
103 class LOCKABLE Thread : public MessageQueue { | 103 class LOCKABLE Thread : public MessageQueue { |
104 protected: | 104 public: |
| 105 // Create a new Thread and optionally assign it to the passed SocketServer. |
105 Thread(); | 106 Thread(); |
106 | |
107 public: | |
108 explicit Thread(SocketServer* ss); | 107 explicit Thread(SocketServer* ss); |
109 explicit Thread(std::unique_ptr<SocketServer> ss); | 108 explicit Thread(std::unique_ptr<SocketServer> ss); |
110 | 109 |
111 // NOTE: ALL SUBCLASSES OF Thread MUST CALL Stop() IN THEIR DESTRUCTORS (or | 110 // NOTE: ALL SUBCLASSES OF Thread MUST CALL Stop() IN THEIR DESTRUCTORS (or |
112 // guarantee Stop() is explicitly called before the subclass is destroyed). | 111 // guarantee Stop() is explicitly called before the subclass is destroyed). |
113 // This is required to avoid a data race between the destructor modifying the | 112 // This is required to avoid a data race between the destructor modifying the |
114 // vtable, and the Thread::PreRun calling the virtual method Run(). | 113 // vtable, and the Thread::PreRun calling the virtual method Run(). |
115 ~Thread() override; | 114 ~Thread() override; |
116 | 115 |
117 static std::unique_ptr<Thread> CreateWithSocketServer(); | 116 static std::unique_ptr<Thread> CreateWithSocketServer(); |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 | 323 |
325 private: | 324 private: |
326 rtc::Thread* old_thread_; | 325 rtc::Thread* old_thread_; |
327 | 326 |
328 RTC_DISALLOW_COPY_AND_ASSIGN(AutoSocketServerThread); | 327 RTC_DISALLOW_COPY_AND_ASSIGN(AutoSocketServerThread); |
329 }; | 328 }; |
330 | 329 |
331 } // namespace rtc | 330 } // namespace rtc |
332 | 331 |
333 #endif // WEBRTC_RTC_BASE_THREAD_H_ | 332 #endif // WEBRTC_RTC_BASE_THREAD_H_ |
OLD | NEW |