| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2009 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com) | 3 * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com) |
| 4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. | 4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 #include "wtf/UnusedParam.h" | 48 #include "wtf/UnusedParam.h" |
| 49 #include "wtf/WTFThreadData.h" | 49 #include "wtf/WTFThreadData.h" |
| 50 #include <errno.h> | 50 #include <errno.h> |
| 51 | 51 |
| 52 #if !COMPILER(MSVC) | 52 #if !COMPILER(MSVC) |
| 53 #include <limits.h> | 53 #include <limits.h> |
| 54 #include <sched.h> | 54 #include <sched.h> |
| 55 #include <sys/time.h> | 55 #include <sys/time.h> |
| 56 #endif | 56 #endif |
| 57 | 57 |
| 58 #if OS(MAC_OS_X) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 | 58 #if OS(DARWIN) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 |
| 59 #include <objc/objc-auto.h> | 59 #include <objc/objc-auto.h> |
| 60 #endif | 60 #endif |
| 61 | 61 |
| 62 namespace WTF { | 62 namespace WTF { |
| 63 | 63 |
| 64 class PthreadState { | 64 class PthreadState { |
| 65 WTF_MAKE_FAST_ALLOCATED; | 65 WTF_MAKE_FAST_ALLOCATED; |
| 66 public: | 66 public: |
| 67 enum JoinableState { | 67 enum JoinableState { |
| 68 Joinable, // The default thread state. The thread can be joined on. | 68 Joinable, // The default thread state. The thread can be joined on. |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 } | 198 } |
| 199 | 199 |
| 200 void initializeCurrentThreadInternal(const char* threadName) | 200 void initializeCurrentThreadInternal(const char* threadName) |
| 201 { | 201 { |
| 202 #if HAVE(PTHREAD_SETNAME_NP) | 202 #if HAVE(PTHREAD_SETNAME_NP) |
| 203 pthread_setname_np(threadName); | 203 pthread_setname_np(threadName); |
| 204 #else | 204 #else |
| 205 UNUSED_PARAM(threadName); | 205 UNUSED_PARAM(threadName); |
| 206 #endif | 206 #endif |
| 207 | 207 |
| 208 #if OS(MAC_OS_X) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 | 208 #if OS(DARWIN) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 |
| 209 // All threads that potentially use APIs above the BSD layer must be registe
red with the Objective-C | 209 // All threads that potentially use APIs above the BSD layer must be registe
red with the Objective-C |
| 210 // garbage collector in case API implementations use garbage-collected memor
y. | 210 // garbage collector in case API implementations use garbage-collected memor
y. |
| 211 objc_registerThreadWithCollector(); | 211 objc_registerThreadWithCollector(); |
| 212 #endif | 212 #endif |
| 213 | 213 |
| 214 ThreadIdentifier id = identifierByPthreadHandle(pthread_self()); | 214 ThreadIdentifier id = identifierByPthreadHandle(pthread_self()); |
| 215 ASSERT(id); | 215 ASSERT(id); |
| 216 ThreadIdentifierData::initialize(id); | 216 ThreadIdentifierData::initialize(id); |
| 217 } | 217 } |
| 218 | 218 |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 | 386 |
| 387 void ThreadCondition::broadcast() | 387 void ThreadCondition::broadcast() |
| 388 { | 388 { |
| 389 int result = pthread_cond_broadcast(&m_condition); | 389 int result = pthread_cond_broadcast(&m_condition); |
| 390 ASSERT_UNUSED(result, !result); | 390 ASSERT_UNUSED(result, !result); |
| 391 } | 391 } |
| 392 | 392 |
| 393 } // namespace WTF | 393 } // namespace WTF |
| 394 | 394 |
| 395 #endif // USE(PTHREADS) | 395 #endif // USE(PTHREADS) |
| OLD | NEW |