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 |
67 // Sleeps for the specified duration. | 70 // Sleeps for the specified duration. |
68 static void Sleep(base::TimeDelta duration); | 71 static void Sleep(base::TimeDelta duration); |
69 | 72 |
70 // Sets the thread name visible to debuggers/tools. This has no effect | 73 // Sets the thread name visible to debuggers/tools. This has no effect |
71 // otherwise. This name pointer is not copied internally. Thus, it must stay | 74 // otherwise. This name pointer is not copied internally. Thus, it must stay |
72 // valid until the thread ends. | 75 // valid until the thread ends. |
73 static void SetName(const char* name); | 76 static void SetName(const char* name); |
74 | 77 |
75 // Gets the thread name, if previously set by SetName. | 78 // Gets the thread name, if previously set by SetName. |
76 static const char* GetName(); | 79 static const char* GetName(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 static void SetThreadPriority(PlatformThreadHandle handle, | 113 static void SetThreadPriority(PlatformThreadHandle handle, |
111 ThreadPriority priority); | 114 ThreadPriority priority); |
112 | 115 |
113 private: | 116 private: |
114 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformThread); | 117 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformThread); |
115 }; | 118 }; |
116 | 119 |
117 } // namespace base | 120 } // namespace base |
118 | 121 |
119 #endif // BASE_THREADING_PLATFORM_THREAD_H_ | 122 #endif // BASE_THREADING_PLATFORM_THREAD_H_ |
OLD | NEW |