| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // WARNING: You should *NOT* be using this class directly. PlatformThread is | 5 // WARNING: You should *NOT* be using this class directly. PlatformThread is |
| 6 // the low-level platform-specific abstraction to the OS's threading interface. | 6 // the low-level platform-specific abstraction to the OS's threading interface. |
| 7 // You should instead be using a message-loop driven Thread, see thread.h. | 7 // You should instead be using a message-loop driven Thread, see thread.h. |
| 8 | 8 |
| 9 #ifndef BASE_THREADING_PLATFORM_THREAD_H_ | 9 #ifndef BASE_THREADING_PLATFORM_THREAD_H_ |
| 10 #define BASE_THREADING_PLATFORM_THREAD_H_ | 10 #define BASE_THREADING_PLATFORM_THREAD_H_ |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 virtual ~Delegate() {} | 57 virtual ~Delegate() {} |
| 58 virtual void ThreadMain() = 0; | 58 virtual void ThreadMain() = 0; |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 // Gets the current thread id, which may be useful for logging purposes. | 61 // Gets the current thread id, which may be useful for logging purposes. |
| 62 static PlatformThreadId CurrentId(); | 62 static PlatformThreadId CurrentId(); |
| 63 | 63 |
| 64 // Yield the current thread so another thread can be scheduled. | 64 // Yield the current thread so another thread can be scheduled. |
| 65 static void YieldCurrentThread(); | 65 static void YieldCurrentThread(); |
| 66 | 66 |
| 67 // Sleeps for the specified duration (units are milliseconds). | |
| 68 static void Sleep(int duration_ms); | |
| 69 | |
| 70 // Sleeps for the specified duration. | 67 // Sleeps for the specified duration. |
| 71 static void Sleep(base::TimeDelta duration); | 68 static void Sleep(base::TimeDelta duration); |
| 72 | 69 |
| 73 // Sets the thread name visible to debuggers/tools. This has no effect | 70 // Sets the thread name visible to debuggers/tools. This has no effect |
| 74 // otherwise. This name pointer is not copied internally. Thus, it must stay | 71 // otherwise. This name pointer is not copied internally. Thus, it must stay |
| 75 // valid until the thread ends. | 72 // valid until the thread ends. |
| 76 static void SetName(const char* name); | 73 static void SetName(const char* name); |
| 77 | 74 |
| 78 // Gets the thread name, if previously set by SetName. | 75 // Gets the thread name, if previously set by SetName. |
| 79 static const char* GetName(); | 76 static const char* GetName(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 static void SetThreadPriority(PlatformThreadHandle handle, | 110 static void SetThreadPriority(PlatformThreadHandle handle, |
| 114 ThreadPriority priority); | 111 ThreadPriority priority); |
| 115 | 112 |
| 116 private: | 113 private: |
| 117 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformThread); | 114 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformThread); |
| 118 }; | 115 }; |
| 119 | 116 |
| 120 } // namespace base | 117 } // namespace base |
| 121 | 118 |
| 122 #endif // BASE_THREADING_PLATFORM_THREAD_H_ | 119 #endif // BASE_THREADING_PLATFORM_THREAD_H_ |
| OLD | NEW |