OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 | 67 |
68 // Gets the current thread id, which may be useful for logging purposes. | 68 // Gets the current thread id, which may be useful for logging purposes. |
69 static PlatformThreadId CurrentId(); | 69 static PlatformThreadId CurrentId(); |
70 | 70 |
71 // Yield the current thread so another thread can be scheduled. | 71 // Yield the current thread so another thread can be scheduled. |
72 static void YieldCurrentThread(); | 72 static void YieldCurrentThread(); |
73 | 73 |
74 // Sleeps for the specified duration (units are milliseconds). | 74 // Sleeps for the specified duration (units are milliseconds). |
75 static void Sleep(int duration_ms); | 75 static void Sleep(int duration_ms); |
76 | 76 |
77 // Sets the thread name visible to a debugger. This has no effect otherwise. | 77 // Sets the thread name visible to debuggers/tools. This has no effect |
78 // otherwise. | |
Sigurður Ásgeirsson
2011/08/04 12:31:39
As you don't copy the name, I think you've added a
nduca
2011/08/04 18:17:38
Actually, that's not the case --- the pointer here
| |
78 static void SetName(const char* name); | 79 static void SetName(const char* name); |
79 | 80 |
81 // Gets the thread name, if previously set by SetTName. | |
Sigurður Ásgeirsson
2011/08/04 12:31:39
SetTName->SetName
nduca
2011/08/04 18:17:38
Done.
| |
82 static const char* GetName(); | |
83 | |
80 // Creates a new thread. The |stack_size| parameter can be 0 to indicate | 84 // Creates a new thread. The |stack_size| parameter can be 0 to indicate |
81 // that the default stack size should be used. Upon success, | 85 // that the default stack size should be used. Upon success, |
82 // |*thread_handle| will be assigned a handle to the newly created thread, | 86 // |*thread_handle| will be assigned a handle to the newly created thread, |
83 // and |delegate|'s ThreadMain method will be executed on the newly created | 87 // and |delegate|'s ThreadMain method will be executed on the newly created |
84 // thread. | 88 // thread. |
85 // NOTE: When you are done with the thread handle, you must call Join to | 89 // NOTE: When you are done with the thread handle, you must call Join to |
86 // release system resources associated with the thread. You must ensure that | 90 // release system resources associated with the thread. You must ensure that |
87 // the Delegate object outlives the thread. | 91 // the Delegate object outlives the thread. |
88 static bool Create(size_t stack_size, Delegate* delegate, | 92 static bool Create(size_t stack_size, Delegate* delegate, |
89 PlatformThreadHandle* thread_handle); | 93 PlatformThreadHandle* thread_handle); |
(...skipping 11 matching lines...) Expand all Loading... | |
101 static void SetThreadPriority(PlatformThreadHandle handle, | 105 static void SetThreadPriority(PlatformThreadHandle handle, |
102 ThreadPriority priority); | 106 ThreadPriority priority); |
103 | 107 |
104 private: | 108 private: |
105 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformThread); | 109 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformThread); |
106 }; | 110 }; |
107 | 111 |
108 } // namespace base | 112 } // namespace base |
109 | 113 |
110 #endif // BASE_THREADING_PLATFORM_THREAD_H_ | 114 #endif // BASE_THREADING_PLATFORM_THREAD_H_ |
OLD | NEW |