| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com) | 3 * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com) |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 #if OS(POSIX) | 44 #if OS(POSIX) |
| 45 #include <pthread.h> | 45 #include <pthread.h> |
| 46 #endif | 46 #endif |
| 47 | 47 |
| 48 namespace WTF { | 48 namespace WTF { |
| 49 | 49 |
| 50 #if OS(POSIX) | 50 #if OS(POSIX) |
| 51 struct PlatformMutex { | 51 struct PlatformMutex { |
| 52 pthread_mutex_t m_internalMutex; | 52 pthread_mutex_t m_internalMutex; |
| 53 #if ENABLE(ASSERT) | 53 #if DCHECK_IS_ON() |
| 54 size_t m_recursionCount; | 54 size_t m_recursionCount; |
| 55 #endif | 55 #endif |
| 56 }; | 56 }; |
| 57 typedef pthread_cond_t PlatformCondition; | 57 typedef pthread_cond_t PlatformCondition; |
| 58 #elif OS(WIN) | 58 #elif OS(WIN) |
| 59 struct PlatformMutex { | 59 struct PlatformMutex { |
| 60 CRITICAL_SECTION m_internalMutex; | 60 CRITICAL_SECTION m_internalMutex; |
| 61 size_t m_recursionCount; | 61 size_t m_recursionCount; |
| 62 }; | 62 }; |
| 63 struct PlatformCondition { | 63 struct PlatformCondition { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 78 | 78 |
| 79 class WTF_EXPORT MutexBase { | 79 class WTF_EXPORT MutexBase { |
| 80 WTF_MAKE_NONCOPYABLE(MutexBase); | 80 WTF_MAKE_NONCOPYABLE(MutexBase); |
| 81 USING_FAST_MALLOC(MutexBase); | 81 USING_FAST_MALLOC(MutexBase); |
| 82 | 82 |
| 83 public: | 83 public: |
| 84 ~MutexBase(); | 84 ~MutexBase(); |
| 85 | 85 |
| 86 void lock(); | 86 void lock(); |
| 87 void unlock(); | 87 void unlock(); |
| 88 #if ENABLE(ASSERT) | 88 #if DCHECK_IS_ON() |
| 89 bool locked() { return m_mutex.m_recursionCount > 0; } | 89 bool locked() { return m_mutex.m_recursionCount > 0; } |
| 90 #endif | 90 #endif |
| 91 | 91 |
| 92 public: | 92 public: |
| 93 PlatformMutex& impl() { return m_mutex; } | 93 PlatformMutex& impl() { return m_mutex; } |
| 94 | 94 |
| 95 protected: | 95 protected: |
| 96 MutexBase(bool recursive); | 96 MutexBase(bool recursive); |
| 97 | 97 |
| 98 PlatformMutex m_mutex; | 98 PlatformMutex m_mutex; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 using WTF::RecursiveMutex; | 166 using WTF::RecursiveMutex; |
| 167 using WTF::MutexLocker; | 167 using WTF::MutexLocker; |
| 168 using WTF::MutexTryLocker; | 168 using WTF::MutexTryLocker; |
| 169 using WTF::ThreadCondition; | 169 using WTF::ThreadCondition; |
| 170 | 170 |
| 171 #if OS(WIN) | 171 #if OS(WIN) |
| 172 using WTF::absoluteTimeToWaitTimeoutInterval; | 172 using WTF::absoluteTimeToWaitTimeoutInterval; |
| 173 #endif | 173 #endif |
| 174 | 174 |
| 175 #endif // ThreadingPrimitives_h | 175 #endif // ThreadingPrimitives_h |
| OLD | NEW |