OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include "base/platform_thread.h" | 5 #include "base/platform_thread.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/win_util.h" | 8 #include "base/win_util.h" |
9 | 9 |
10 namespace { | 10 namespace { |
(...skipping 12 matching lines...) Expand all Loading... |
23 DWORD __stdcall ThreadFunc(void* closure) { | 23 DWORD __stdcall ThreadFunc(void* closure) { |
24 PlatformThread::Delegate* delegate = | 24 PlatformThread::Delegate* delegate = |
25 static_cast<PlatformThread::Delegate*>(closure); | 25 static_cast<PlatformThread::Delegate*>(closure); |
26 delegate->ThreadMain(); | 26 delegate->ThreadMain(); |
27 return NULL; | 27 return NULL; |
28 } | 28 } |
29 | 29 |
30 } // namespace | 30 } // namespace |
31 | 31 |
32 // static | 32 // static |
33 int PlatformThread::CurrentId() { | 33 PlatformThreadId PlatformThread::CurrentId() { |
34 return GetCurrentThreadId(); | 34 return GetCurrentThreadId(); |
35 } | 35 } |
36 | 36 |
37 // static | 37 // static |
38 void PlatformThread::YieldCurrentThread() { | 38 void PlatformThread::YieldCurrentThread() { |
39 ::Sleep(0); | 39 ::Sleep(0); |
40 } | 40 } |
41 | 41 |
42 // static | 42 // static |
43 void PlatformThread::Sleep(int duration_ms) { | 43 void PlatformThread::Sleep(int duration_ms) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 void PlatformThread::Join(PlatformThreadHandle thread_handle) { | 88 void PlatformThread::Join(PlatformThreadHandle thread_handle) { |
89 DCHECK(thread_handle); | 89 DCHECK(thread_handle); |
90 | 90 |
91 // Wait for the thread to exit. It should already have terminated but make | 91 // Wait for the thread to exit. It should already have terminated but make |
92 // sure this assumption is valid. | 92 // sure this assumption is valid. |
93 DWORD result = WaitForSingleObject(thread_handle, INFINITE); | 93 DWORD result = WaitForSingleObject(thread_handle, INFINITE); |
94 DCHECK_EQ(WAIT_OBJECT_0, result); | 94 DCHECK_EQ(WAIT_OBJECT_0, result); |
95 | 95 |
96 CloseHandle(thread_handle); | 96 CloseHandle(thread_handle); |
97 } | 97 } |
OLD | NEW |