Chromium Code Reviews| 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 173 // CreateNonJoinable() does the same thing as Create() except the thread | 173 // CreateNonJoinable() does the same thing as Create() except the thread |
| 174 // cannot be Join()'d. Therefore, it also does not output a | 174 // cannot be Join()'d. Therefore, it also does not output a |
| 175 // PlatformThreadHandle. | 175 // PlatformThreadHandle. |
| 176 static bool CreateNonJoinable(size_t stack_size, Delegate* delegate); | 176 static bool CreateNonJoinable(size_t stack_size, Delegate* delegate); |
| 177 | 177 |
| 178 // Joins with a thread created via the Create function. This function blocks | 178 // Joins with a thread created via the Create function. This function blocks |
| 179 // the caller until the designated thread exits. This will invalidate | 179 // the caller until the designated thread exits. This will invalidate |
| 180 // |thread_handle|. | 180 // |thread_handle|. |
| 181 static void Join(PlatformThreadHandle thread_handle); | 181 static void Join(PlatformThreadHandle thread_handle); |
| 182 | 182 |
| 183 // Detaches and releases the thread handle. The thread is no longer joinable | |
| 184 // after this call. | |
|
danakj
2016/06/09 22:58:07
And the PlatformThreadHandle becomes invalid?
On
robliao
2016/06/10 14:24:31
Yup, the PlatformThreadHandle becomes invalid. Upd
| |
| 185 static void Detach(PlatformThreadHandle thread_handle); | |
| 186 | |
| 183 // Toggles the current thread's priority at runtime. A thread may not be able | 187 // Toggles the current thread's priority at runtime. A thread may not be able |
| 184 // to raise its priority back up after lowering it if the process does not | 188 // to raise its priority back up after lowering it if the process does not |
| 185 // have a proper permission, e.g. CAP_SYS_NICE on Linux. A thread may not be | 189 // have a proper permission, e.g. CAP_SYS_NICE on Linux. A thread may not be |
| 186 // able to lower its priority back down after raising it to REALTIME_AUDIO. | 190 // able to lower its priority back down after raising it to REALTIME_AUDIO. |
| 187 // Since changing other threads' priority is not permitted in favor of | 191 // Since changing other threads' priority is not permitted in favor of |
| 188 // security, this interface is restricted to change only the current thread | 192 // security, this interface is restricted to change only the current thread |
| 189 // priority (https://crbug.com/399473). | 193 // priority (https://crbug.com/399473). |
| 190 static void SetCurrentThreadPriority(ThreadPriority priority); | 194 static void SetCurrentThreadPriority(ThreadPriority priority); |
| 191 | 195 |
| 192 static ThreadPriority GetCurrentThreadPriority(); | 196 static ThreadPriority GetCurrentThreadPriority(); |
| 193 | 197 |
| 194 private: | 198 private: |
| 195 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformThread); | 199 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformThread); |
| 196 }; | 200 }; |
| 197 | 201 |
| 198 } // namespace base | 202 } // namespace base |
| 199 | 203 |
| 200 #endif // BASE_THREADING_PLATFORM_THREAD_H_ | 204 #endif // BASE_THREADING_PLATFORM_THREAD_H_ |
| OLD | NEW |