| 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 10 matching lines...) Expand all Loading... |
| 21 #include <pthread.h> | 21 #include <pthread.h> |
| 22 #endif | 22 #endif |
| 23 #include "webrtc/base/constructormagic.h" | 23 #include "webrtc/base/constructormagic.h" |
| 24 #include "webrtc/base/event.h" | 24 #include "webrtc/base/event.h" |
| 25 #include "webrtc/base/messagequeue.h" | 25 #include "webrtc/base/messagequeue.h" |
| 26 | 26 |
| 27 #if defined(WEBRTC_WIN) | 27 #if defined(WEBRTC_WIN) |
| 28 #include "webrtc/base/win32.h" | 28 #include "webrtc/base/win32.h" |
| 29 #endif | 29 #endif |
| 30 | 30 |
| 31 #if defined(WEBRTC_WIN) |
| 32 # define THREAD_CALLING_CONV __stdcall |
| 33 #else // WEBRTC_WIN |
| 34 # define THREAD_CALLING_CONV |
| 35 #endif // WEBRTC_WIN |
| 36 |
| 31 namespace rtc { | 37 namespace rtc { |
| 32 | 38 |
| 33 class Thread; | 39 class Thread; |
| 34 | 40 |
| 35 class ThreadManager { | 41 class ThreadManager { |
| 36 public: | 42 public: |
| 37 static const int kForever = -1; | 43 static const int kForever = -1; |
| 38 | 44 |
| 39 ThreadManager(); | 45 ThreadManager(); |
| 40 ~ThreadManager(); | 46 ~ThreadManager(); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 void SafeWrapCurrent(); | 237 void SafeWrapCurrent(); |
| 232 | 238 |
| 233 // Blocks the calling thread until this thread has terminated. | 239 // Blocks the calling thread until this thread has terminated. |
| 234 void Join(); | 240 void Join(); |
| 235 | 241 |
| 236 static void AssertBlockingIsAllowedOnCurrentThread(); | 242 static void AssertBlockingIsAllowedOnCurrentThread(); |
| 237 | 243 |
| 238 friend class ScopedDisallowBlockingCalls; | 244 friend class ScopedDisallowBlockingCalls; |
| 239 | 245 |
| 240 private: | 246 private: |
| 241 static void *PreRun(void *pv); | 247 static void* THREAD_CALLING_CONV PreRun(void *pv); |
| 242 | 248 |
| 243 // ThreadManager calls this instead WrapCurrent() because | 249 // ThreadManager calls this instead WrapCurrent() because |
| 244 // ThreadManager::Instance() cannot be used while ThreadManager is | 250 // ThreadManager::Instance() cannot be used while ThreadManager is |
| 245 // being created. | 251 // being created. |
| 246 // The method tries to get synchronization rights of the thread on Windows if | 252 // The method tries to get synchronization rights of the thread on Windows if |
| 247 // |need_synchronize_access| is true. | 253 // |need_synchronize_access| is true. |
| 248 bool WrapCurrentWithThreadManager(ThreadManager* thread_manager, | 254 bool WrapCurrentWithThreadManager(ThreadManager* thread_manager, |
| 249 bool need_synchronize_access); | 255 bool need_synchronize_access); |
| 250 | 256 |
| 251 // Return true if the thread was started and hasn't yet stopped. | 257 // Return true if the thread was started and hasn't yet stopped. |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 | 331 |
| 326 private: | 332 private: |
| 327 SocketServer* old_ss_; | 333 SocketServer* old_ss_; |
| 328 | 334 |
| 329 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(SocketServerScope); | 335 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(SocketServerScope); |
| 330 }; | 336 }; |
| 331 | 337 |
| 332 } // namespace rtc | 338 } // namespace rtc |
| 333 | 339 |
| 334 #endif // WEBRTC_BASE_THREAD_H_ | 340 #endif // WEBRTC_BASE_THREAD_H_ |
| OLD | NEW |