| 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 13 matching lines...) Expand all Loading... |
| 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "sky/engine/config.h" | 31 #include "sky/engine/config.h" |
| 32 #include "sky/engine/wtf/Threading.h" | 32 #include "sky/engine/wtf/Threading.h" |
| 33 | 33 |
| 34 #if USE(PTHREADS) | |
| 35 | |
| 36 #include <errno.h> | 34 #include <errno.h> |
| 37 #include "sky/engine/wtf/DateMath.h" | 35 #include "sky/engine/wtf/DateMath.h" |
| 38 #include "sky/engine/wtf/HashMap.h" | 36 #include "sky/engine/wtf/HashMap.h" |
| 39 #include "sky/engine/wtf/OwnPtr.h" | 37 #include "sky/engine/wtf/OwnPtr.h" |
| 40 #include "sky/engine/wtf/PassOwnPtr.h" | 38 #include "sky/engine/wtf/PassOwnPtr.h" |
| 41 #include "sky/engine/wtf/StdLibExtras.h" | 39 #include "sky/engine/wtf/StdLibExtras.h" |
| 42 #include "sky/engine/wtf/ThreadIdentifierDataPthreads.h" | 40 #include "sky/engine/wtf/ThreadIdentifierDataPthreads.h" |
| 43 #include "sky/engine/wtf/ThreadSpecific.h" | 41 #include "sky/engine/wtf/ThreadSpecific.h" |
| 44 #include "sky/engine/wtf/ThreadingPrimitives.h" | 42 #include "sky/engine/wtf/ThreadingPrimitives.h" |
| 45 #include "sky/engine/wtf/WTFThreadData.h" | 43 #include "sky/engine/wtf/WTFThreadData.h" |
| 46 #include "sky/engine/wtf/dtoa.h" | 44 #include "sky/engine/wtf/dtoa.h" |
| 47 #include "wtf/dtoa/cached-powers.h" | 45 #include "wtf/dtoa/cached-powers.h" |
| 48 | 46 |
| 49 #include <limits.h> | 47 #include <limits.h> |
| 50 #include <sched.h> | 48 #include <sched.h> |
| 51 #include <sys/time.h> | 49 #include <sys/time.h> |
| 52 | 50 |
| 51 #if USE(PTHREADS) |
| 52 |
| 53 namespace WTF { | 53 namespace WTF { |
| 54 | 54 |
| 55 class PthreadState { | 55 class PthreadState { |
| 56 WTF_MAKE_FAST_ALLOCATED; | 56 WTF_MAKE_FAST_ALLOCATED; |
| 57 public: | 57 public: |
| 58 enum JoinableState { | 58 enum JoinableState { |
| 59 Joinable, // The default thread state. The thread can be joined on. | 59 Joinable, // The default thread state. The thread can be joined on. |
| 60 | 60 |
| 61 Joined, // Somebody waited on this thread to exit and this thread finall
y exited. This state is here because there can be a | 61 Joined, // Somebody waited on this thread to exit and this thread finall
y exited. This state is here because there can be a |
| 62 // period of time between when the thread exits (which causes pt
hread_join to return and the remainder of waitOnThreadCompletion to run) | 62 // period of time between when the thread exits (which causes pt
hread_join to return and the remainder of waitOnThreadCompletion to run) |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 | 320 |
| 321 void ThreadCondition::broadcast() | 321 void ThreadCondition::broadcast() |
| 322 { | 322 { |
| 323 int result = pthread_cond_broadcast(&m_condition); | 323 int result = pthread_cond_broadcast(&m_condition); |
| 324 ASSERT_UNUSED(result, !result); | 324 ASSERT_UNUSED(result, !result); |
| 325 } | 325 } |
| 326 | 326 |
| 327 } // namespace WTF | 327 } // namespace WTF |
| 328 | 328 |
| 329 #endif // USE(PTHREADS) | 329 #endif // USE(PTHREADS) |
| OLD | NEW |