Chromium Code Reviews| 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) | |
| 54 size_t m_recursionCount; | 53 size_t m_recursionCount; |
|
esprehn
2016/08/05 23:18:56
I don't think we want to do this, it makes all of
| |
| 55 #endif | |
| 56 }; | 54 }; |
| 57 typedef pthread_cond_t PlatformCondition; | 55 typedef pthread_cond_t PlatformCondition; |
| 58 #elif OS(WIN) | 56 #elif OS(WIN) |
| 59 struct PlatformMutex { | 57 struct PlatformMutex { |
| 60 CRITICAL_SECTION m_internalMutex; | 58 CRITICAL_SECTION m_internalMutex; |
| 61 size_t m_recursionCount; | 59 size_t m_recursionCount; |
| 62 }; | 60 }; |
| 63 struct PlatformCondition { | 61 struct PlatformCondition { |
| 64 size_t m_waitersGone; | 62 size_t m_waitersGone; |
| 65 size_t m_waitersBlocked; | 63 size_t m_waitersBlocked; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 76 typedef void* PlatformCondition; | 74 typedef void* PlatformCondition; |
| 77 #endif | 75 #endif |
| 78 | 76 |
| 79 class WTF_EXPORT MutexBase { | 77 class WTF_EXPORT MutexBase { |
| 80 WTF_MAKE_NONCOPYABLE(MutexBase); USING_FAST_MALLOC(MutexBase); | 78 WTF_MAKE_NONCOPYABLE(MutexBase); USING_FAST_MALLOC(MutexBase); |
| 81 public: | 79 public: |
| 82 ~MutexBase(); | 80 ~MutexBase(); |
| 83 | 81 |
| 84 void lock(); | 82 void lock(); |
| 85 void unlock(); | 83 void unlock(); |
| 86 #if ENABLE(ASSERT) | |
| 87 bool locked() { return m_mutex.m_recursionCount > 0; } | 84 bool locked() { return m_mutex.m_recursionCount > 0; } |
| 88 #endif | |
| 89 | 85 |
| 90 public: | 86 public: |
| 91 PlatformMutex& impl() { return m_mutex; } | 87 PlatformMutex& impl() { return m_mutex; } |
| 92 | 88 |
| 93 protected: | 89 protected: |
| 94 MutexBase(bool recursive); | 90 MutexBase(bool recursive); |
| 95 | 91 |
| 96 PlatformMutex m_mutex; | 92 PlatformMutex m_mutex; |
| 97 }; | 93 }; |
| 98 | 94 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 159 using WTF::RecursiveMutex; | 155 using WTF::RecursiveMutex; |
| 160 using WTF::MutexLocker; | 156 using WTF::MutexLocker; |
| 161 using WTF::MutexTryLocker; | 157 using WTF::MutexTryLocker; |
| 162 using WTF::ThreadCondition; | 158 using WTF::ThreadCondition; |
| 163 | 159 |
| 164 #if OS(WIN) | 160 #if OS(WIN) |
| 165 using WTF::absoluteTimeToWaitTimeoutInterval; | 161 using WTF::absoluteTimeToWaitTimeoutInterval; |
| 166 #endif | 162 #endif |
| 167 | 163 |
| 168 #endif // ThreadingPrimitives_h | 164 #endif // ThreadingPrimitives_h |
| OLD | NEW |