| 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 // Pthread compatability routines. | 5 // Pthread compatability routines. |
| 6 // TODO(timsteele): This file is deprecated. Use PlatformThread. | 6 // TODO(timsteele): This file is deprecated. Use PlatformThread. |
| 7 | 7 |
| 8 #ifndef CHROME_BROWSER_SYNC_UTIL_COMPAT_PTHREAD_H_ | 8 #ifndef CHROME_BROWSER_SYNC_UTIL_COMPAT_PTHREAD_H_ |
| 9 #define CHROME_BROWSER_SYNC_UTIL_COMPAT_PTHREAD_H_ | 9 #define CHROME_BROWSER_SYNC_UTIL_COMPAT_PTHREAD_H_ |
| 10 | 10 |
| 11 #include "base/platform_thread.h" | 11 #include "base/platform_thread.h" |
| 12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 | 13 |
| 14 #define ThreadId PlatformThreadId | 14 #define ThreadId PlatformThreadId |
| 15 | 15 |
| 16 #ifndef OS_WIN | 16 #ifndef OS_WIN |
| 17 inline ThreadId GetCurrentThreadId() { | 17 inline ThreadId GetCurrentThreadId() { |
| 18 return PlatformThread::CurrentId(); | 18 return PlatformThread::CurrentId(); |
| 19 } | 19 } |
| 20 #endif // OS_WIN | 20 #endif // OS_WIN |
| 21 | 21 |
| 22 #if (!defined(OS_WIN) && !defined(OS_MACOSX)) | |
| 23 // TODO(timsteele): What the heck is this? | |
| 24 inline int sem_post_multiple(sem_t* sem, int number) { | |
| 25 int i; | |
| 26 int r = 0; | |
| 27 for (i = 0; i < number; i++) { | |
| 28 r = sem_post(sem); | |
| 29 if (r != 0) { | |
| 30 LOG_IF(ERROR, i > 0) << "sem_post() failed on iteration #" << i << | |
| 31 " of " << number; | |
| 32 return r; | |
| 33 } | |
| 34 } | |
| 35 return 0; | |
| 36 } | |
| 37 #endif // (!defined(OS_WIN) && !defined(OS_MACOSX)) | |
| 38 | |
| 39 #endif // CHROME_BROWSER_SYNC_UTIL_COMPAT_PTHREAD_H_ | 22 #endif // CHROME_BROWSER_SYNC_UTIL_COMPAT_PTHREAD_H_ |
| OLD | NEW |