OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #ifndef CHROME_BROWSER_SYNC_UTIL_PTHREAD_HELPERS_H_ | 5 #ifndef CHROME_BROWSER_SYNC_UTIL_PTHREAD_HELPERS_H_ |
6 #define CHROME_BROWSER_SYNC_UTIL_PTHREAD_HELPERS_H_ | 6 #define CHROME_BROWSER_SYNC_UTIL_PTHREAD_HELPERS_H_ |
7 | 7 |
8 #include <pthread.h> | 8 #include <pthread.h> |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "build/build_config.h" |
10 | 11 |
11 #ifdef OS_WINDOWS | 12 #ifdef OS_WIN |
12 typedef void* thread_handle; | 13 typedef void* thread_handle; |
13 #else | 14 #else |
14 typedef pthread_t thread_handle; | 15 typedef pthread_t thread_handle; |
15 #endif | 16 #endif |
16 | 17 |
17 // Creates a pthread, detaches from it, and returns a Win32 HANDLE for it that | 18 // Creates a pthread, detaches from it, and returns a Win32 HANDLE for it that |
18 // the caller must CloseHandle(). | 19 // the caller must CloseHandle(). |
19 thread_handle CreatePThread(void* (*start)(void* payload), void* parameter); | 20 thread_handle CreatePThread(void* (*start)(void* payload), void* parameter); |
20 | 21 |
21 class PThreadRWLock { | 22 class PThreadRWLock { |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 | 251 |
251 // Returns the absolute time ms milliseconds from now. Useful for passing | 252 // Returns the absolute time ms milliseconds from now. Useful for passing |
252 // result to pthread_cond_timedwait(). | 253 // result to pthread_cond_timedwait(). |
253 struct timespec GetPThreadAbsoluteTime(uint32 ms_from_now); | 254 struct timespec GetPThreadAbsoluteTime(uint32 ms_from_now); |
254 | 255 |
255 // Assign a descriptive label to the current thread. This is useful to see | 256 // Assign a descriptive label to the current thread. This is useful to see |
256 // in a GUI debugger, but may not be implementable on all platforms. | 257 // in a GUI debugger, but may not be implementable on all platforms. |
257 void NameCurrentThreadForDebugging(char* name); | 258 void NameCurrentThreadForDebugging(char* name); |
258 | 259 |
259 #endif // CHROME_BROWSER_SYNC_UTIL_PTHREAD_HELPERS_H_ | 260 #endif // CHROME_BROWSER_SYNC_UTIL_PTHREAD_HELPERS_H_ |
OLD | NEW |