| 1 | /* |
| 2 | * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 3 | * Copyright (C) 2007 Justin Haygood ([email protected]) |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions |
| 7 | * are met: |
| 8 | * |
| 9 | * 1. Redistributions of source code must retain the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer. |
| 11 | * 2. Redistributions in binary form must reproduce the above copyright |
| 12 | * notice, this list of conditions and the following disclaimer in the |
| 13 | * documentation and/or other materials provided with the distribution. |
| 14 | * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of |
| 15 | * its contributors may be used to endorse or promote products derived |
| 16 | * from this software without specific prior written permission. |
| 17 | * |
| 18 | * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY |
| 19 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 21 | * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY |
| 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | * |
| 29 | * |
| 30 | * Note: The implementations of InterlockedIncrement and InterlockedDecrement are based |
| 31 | * on atomic_increment and atomic_exchange_and_add from the Boost C++ Library. The license |
| 32 | * is virtually identical to the Apple license above but is included here for completeness. |
| 33 | * |
| 34 | * Boost Software License - Version 1.0 - August 17th, 2003 |
| 35 | * |
| 36 | * Permission is hereby granted, free of charge, to any person or organization |
| 37 | * obtaining a copy of the software and accompanying documentation covered by |
| 38 | * this license (the "Software") to use, reproduce, display, distribute, |
| 39 | * execute, and transmit the Software, and to prepare derivative works of the |
| 40 | * Software, and to permit third-parties to whom the Software is furnished to |
| 41 | * do so, all subject to the following: |
| 42 | * |
| 43 | * The copyright notices in the Software and this entire statement, including |
| 44 | * the above license grant, this restriction and the following disclaimer, |
| 45 | * must be included in all copies of the Software, in whole or in part, and |
| 46 | * all derivative works of the Software, unless such copies or derivative |
| 47 | * works are solely in the form of machine-executable object code generated by |
| 48 | * a source language processor. |
| 49 | * |
| 50 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 51 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 52 | * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT |
| 53 | * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE |
| 54 | * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, |
| 55 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 56 | * DEALINGS IN THE SOFTWARE. |
| 57 | */ |
| 58 | |
| 59 | #ifndef Threading_h |
| 60 | #define Threading_hcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h:60:9`! |
| 61 | |
| 62 | #include "Platform.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h`/ |
| 63 | |
| 64 | #if OScxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:49:9`!(WINCE) |
| 65 | #include <windows.h> |
| 66 | #endif |
| 67 | |
| 68 | #include <wtf/Assertions.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h`/ |
| 69 | #include <wtf/Locker.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Locker.h`/ |
| 70 | #include <wtf/Noncopyable.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Noncopyable.h`/ |
| 71 | |
| 72 | #if OScxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:49:9`!(WINDOWS) && !OScxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:49:9`!(WINCE) |
| 73 | #include <windows.h> |
| 74 | #elif OScxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:49:9`!(ANDROID) && !PLATFORMcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:33:9`!(QT) |
| 75 | #include <cutils/atomic.h> |
| 76 | #elif OScxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:49:9`!(QNX) |
| 77 | #include <atomic.h> |
| 78 | #endif |
| 79 | |
| 80 | #if USEcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:55:9`!(PTHREADS) |
| 81 | #include <pthread.h> |
| 82 | #elif PLATFORMcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:33:9`!(GTK) |
| 83 | #include <wtf/gtk/GOwnPtr.h> |
| 84 | typedef struct _GMutex GMutex; |
| 85 | typedef struct _GCond GCond; |
| 86 | #endif |
| 87 | |
| 88 | #if PLATFORMcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:33:9`!(QT) |
| 89 | #include <qglobal.h> |
| 90 | QT_BEGIN_NAMESPACEcxx . . $ `<external>/15045578679651060896/qglobal.h:148:10`! |
| 91 | class QMutexcxx . . $ QMutex#; |
| 92 | class QWaitConditioncxx . . $ QWaitCondition#; |
| 93 | QT_END_NAMESPACEcxx . . $ `<external>/15045578679651060896/qglobal.h:149:10`! |
| 94 | #endif |
| 95 | |
| 96 | #include <stdint.h> |
| 97 | |
| 98 | // For portability, we do not use thread-safe statics natively supported by some compilers (e.g. gcc). |
| 99 | #define AtomicallyInitializedStaticcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h:99:9`!(T, name) \ |
| 100 | WTF::lockAtomicallyInitializedStaticMutex(); \ |
| 101 | static T name; \ |
| 102 | WTF::unlockAtomicallyInitializedStaticMutex(); |
| 103 | |
| 104 | namespace WTFcxx . . $ `<built-in>:467:9`! { |
| 105 | |
| 106 | typedef uint32_tcxx . . $ uint32_t# ThreadIdentifiercxx . . $ QTWTF/ThreadIdentifier#; |
| 107 | typedef void* (*ThreadFunctioncxx . . $ QTWTF/ThreadFunction#)(void* argument); |
| 108 | |
| 109 | // Returns 0 if thread creation failed. |
| 110 | // The thread name must be a literal since on some platforms it's passed in to the thread. |
| 111 | ThreadIdentifiercxx . . $ QTWTF/ThreadIdentifier# createThreadcxx . . $ QTWTF/createThread(37a5e2dd1ac91d50).(ThreadFunctioncxx . . $ QTWTF/ThreadFunction#, void*, const char* threadName); |
| 112 | |
| 113 | // Internal platform-specific createThread implementation. |
| 114 | ThreadIdentifiercxx . . $ QTWTF/ThreadIdentifier# createThreadInternalcxx . . $ QTWTF/createThreadInternal(37a5e2dd1ac91d50).(ThreadFunctioncxx . . $ QTWTF/ThreadFunction#, void*, const char* threadName); |
| 115 | |
| 116 | // Called in the thread during initialization. |
| 117 | // Helpful for platforms where the thread name must be set from within the thread. |
| 118 | void initializeCurrentThreadInternalcxx . . $ QTWTF/initializeCurrentThreadInternal(85c52e162fed56f9).(const char* threadName); |
| 119 | |
| 120 | ThreadIdentifiercxx . . $ QTWTF/ThreadIdentifier# currentThreadcxx . . $ QTWTF/currentThread(db52760e79bf9054).(); |
| 121 | bool isMainThreadcxx . . $ QTWTF/isMainThread(c9857a73d68e59ba).(); |
| 122 | int waitForThreadCompletioncxx . . $ QTWTF/waitForThreadCompletion(83ff549750eb75a).(ThreadIdentifiercxx . . $ QTWTF/ThreadIdentifier#, void**); |
| 123 | void detachThreadcxx . . $ QTWTF/detachThread(cb2f890c2fdad230).(ThreadIdentifiercxx . . $ QTWTF/ThreadIdentifier#); |
| 124 | |
| 125 | #if USEcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:55:9`!(PTHREADS) |
| 126 | typedef pthread_mutex_t PlatformMutex; |
| 127 | #if HAVE(PTHREAD_RWLOCK) |
| 128 | typedef pthread_rwlock_t PlatformReadWriteLock; |
| 129 | #else |
| 130 | typedef void* PlatformReadWriteLock; |
| 131 | #endif |
| 132 | typedef pthread_cond_t PlatformCondition; |
| 133 | #elif PLATFORMcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:33:9`!(GTK) |
| 134 | typedef GOwnPtr<GMutex> PlatformMutex; |
| 135 | typedef void* PlatformReadWriteLock; // FIXME: Implement. |
| 136 | typedef GOwnPtr<GCond> PlatformCondition; |
| 137 | #elif PLATFORMcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:33:9`!(QT) |
| 138 | typedef QT_PREPEND_NAMESPACEcxx . . $ `<external>/15045578679651060896/qglobal.h:146:10`!(QMutex)* PlatformMutexcxx . . $ QTWTF/PlatformMutex#; |
| 139 | typedef void* PlatformReadWriteLockcxx . . $ QTWTF/PlatformReadWriteLock#; // FIXME: Implement. |
| 140 | typedef QT_PREPEND_NAMESPACEcxx . . $ `<external>/15045578679651060896/qglobal.h:146:10`!(QWaitCondition)* PlatformConditioncxx . . $ QTWTF/PlatformCondition#; |
| 141 | #elif OS(WINDOWS) |
| 142 | struct PlatformMutex { |
| 143 | CRITICAL_SECTION m_internalMutex; |
| 144 | size_t m_recursionCount; |
| 145 | }; |
| 146 | typedef void* PlatformReadWriteLock; // FIXME: Implement. |
| 147 | struct PlatformCondition { |
| 148 | size_t m_waitersGone; |
| 149 | size_t m_waitersBlocked; |
| 150 | size_t m_waitersToUnblock; |
| 151 | HANDLE m_blockLock; |
| 152 | HANDLE m_blockQueue; |
| 153 | HANDLE m_unblockLock; |
| 154 | |
| 155 | bool timedWait(PlatformMutex&, DWORD durationMilliseconds); |
| 156 | void signal(bool unblockAll); |
| 157 | }; |
| 158 | #else |
| 159 | typedef void* PlatformMutex; |
| 160 | typedef void* PlatformReadWriteLock; |
| 161 | typedef void* PlatformCondition; |
| 162 | #endif |
| 163 | |
| 164 | class Mutexcxx . . $ QTWTF/Mutex# : public Noncopyablecxx . . $ Noncopyable# { |
| 165 | public: |
| 166 | Mutexcxx . . $ QTWTF/Mutex#Mutex(49f6e7a06ebc5aa8).(); |
| 167 | ~cxx . . $ QTWTF/Mutex#`~Mutex`(49f6e7a06ebc5aa8).Mutexcxx . . $ QTWTF/Mutex#(); |
| 168 | |
| 169 | void lockcxx . . $ QTWTF/Mutex#lock(49f6e7a06ebc5aa8).(); |
| 170 | bool tryLockcxx . . $ QTWTF/Mutex#tryLock(c9857a73d68e59ba).(); |
| 171 | void unlockcxx . . $ QTWTF/Mutex#unlock(49f6e7a06ebc5aa8).(); |
| 172 | |
| 173 | public: |
| 174 | PlatformMutexcxx . . $ QTWTF/PlatformMutex#& implcxx . . $ QTWTF/Mutex#impl(bdad9b8008509e77).() { return m_mutexcxx . . $ QTWTF/Mutex#m_mutex.; } |
| 175 | private: |
| 176 | PlatformMutexcxx . . $ QTWTF/PlatformMutex# m_mutexcxx . . $ QTWTF/Mutex#m_mutex.; |
| 177 | }; |
| 178 | |
| 179 | typedef Lockercxx . . $ QTWTF/Locker#<Mutexcxx . . $ QTWTF/Mutex#> MutexLockercxx . . $ QTWTF/MutexLocker#; |
| 180 | |
| 181 | class ReadWriteLockcxx . . $ QTWTF/ReadWriteLock# : public Noncopyablecxx . . $ Noncopyable# { |
| 182 | public: |
| 183 | ReadWriteLockcxx . . $ QTWTF/ReadWriteLock#ReadWriteLock(49f6e7a06ebc5aa8).(); |
| 184 | ~cxx . . $ QTWTF/ReadWriteLock#`~ReadWriteLock`(49f6e7a06ebc5aa8).ReadWriteLockcxx . . $ QTWTF/ReadWriteLock#(); |
| 185 | |
| 186 | void readLockcxx . . $ QTWTF/ReadWriteLock#readLock(49f6e7a06ebc5aa8).(); |
| 187 | bool tryReadLockcxx . . $ QTWTF/ReadWriteLock#tryReadLock(c9857a73d68e59ba).(); |
| 188 | |
| 189 | void writeLockcxx . . $ QTWTF/ReadWriteLock#writeLock(49f6e7a06ebc5aa8).(); |
| 190 | bool tryWriteLockcxx . . $ QTWTF/ReadWriteLock#tryWriteLock(c9857a73d68e59ba).(); |
| 191 | |
| 192 | void unlockcxx . . $ QTWTF/ReadWriteLock#unlock(49f6e7a06ebc5aa8).(); |
| 193 | |
| 194 | private: |
| 195 | PlatformReadWriteLockcxx . . $ QTWTF/PlatformReadWriteLock# m_readWriteLockcxx . . $ QTWTF/ReadWriteLock#m_readWriteLock.; |
| 196 | }; |
| 197 | |
| 198 | class ThreadConditioncxx . . $ QTWTF/ThreadCondition# : public Noncopyablecxx . . $ Noncopyable# { |
| 199 | public: |
| 200 | ThreadConditioncxx . . $ QTWTF/ThreadCondition#ThreadCondition(49f6e7a06ebc5aa8).(); |
| 201 | ~cxx . . $ QTWTF/ThreadCondition#`~ThreadCondition`(49f6e7a06ebc5aa8).ThreadConditioncxx . . $ QTWTF/ThreadCondition#(); |
| 202 | |
| 203 | void waitcxx . . $ QTWTF/ThreadCondition#wait(64d77b5f56d9f146).(Mutexcxx . . $ QTWTF/Mutex#& mutex); |
| 204 | // Returns true if the condition was signaled before absoluteTime, false if the absoluteTime was reached or is in the past. |
| 205 | // The absoluteTime is in seconds, starting on January 1, 1970. The time is assumed to use the same time zone as WTF::currentTime(). |
| 206 | bool timedWaitcxx . . $ QTWTF/ThreadCondition#timedWait(3b76ff20f9e5fde9).(Mutexcxx . . $ QTWTF/Mutex#&, double absoluteTime); |
| 207 | void signalcxx . . $ QTWTF/ThreadCondition#signal(49f6e7a06ebc5aa8).(); |
| 208 | void broadcastcxx . . $ QTWTF/ThreadCondition#broadcast(49f6e7a06ebc5aa8).(); |
| 209 | |
| 210 | private: |
| 211 | PlatformConditioncxx . . $ QTWTF/PlatformCondition# m_conditioncxx . . $ QTWTF/ThreadCondition#m_condition.; |
| 212 | }; |
| 213 | |
| 214 | #if OScxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:49:9`!(WINDOWS) |
| 215 | #define WTF_USE_LOCKFREE_THREADSAFESHARED 1 |
| 216 | |
| 217 | #if COMPILER(MINGW) || COMPILER(MSVC7) || OS(WINCE) |
| 218 | inline int atomicIncrement(int* addend) { return InterlockedIncrement(reinterpret_cast<long*>(addend)); } |
| 219 | inline int atomicDecrement(int* addend) { return InterlockedDecrement(reinterpret_cast<long*>(addend)); } |
| 220 | #else |
| 221 | inline int atomicIncrement(int volatile* addend) { return InterlockedIncrement(reinterpret_cast<long volatile*>(addend)); } |
| 222 | inline int atomicDecrement(int volatile* addend) { return InterlockedDecrement(reinterpret_cast<long volatile*>(addend)); } |
| 223 | #endif |
| 224 | |
| 225 | #elif OScxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:49:9`!(ANDROID) && !PLATFORMcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:33:9`!(QT) |
| 226 | |
| 227 | inline int atomicIncrement(int volatile* addend) { return android_atomic_inc(addend); } |
| 228 | inline int atomicDecrement(int volatile* addend) { return android_atomic_dec(addend); } |
| 229 | |
| 230 | #elif OScxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:49:9`!(QNX) |
| 231 | |
| 232 | // component functions take and return unsigned |
| 233 | inline int atomicIncrement(int volatile* addend) { return (int) atomic_add_value((unsigned volatile*)addend, 1); } |
| 234 | inline int atomicDecrement(int volatile* addend) { return (int) atomic_sub_value((unsigned volatile*)addend, 1); } |
| 235 | |
| 236 | #elif COMPILERcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:39:9`!(GCC) && !CPUcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:44:9`!(SPARC64) && !OScxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:49:9`!(SYMBIAN) // sizeof(_Atomic_word) != sizeof(int) on sparc64 gcc |
| 237 | #define WTF_USE_LOCKFREE_THREADSAFESHAREDcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h:237:9`! 1 |
| 238 | |
| 239 | inline int atomicIncrementcxx . . $ QTWTF/atomicIncrement(fe996c63fe885c1c).(int volatile* addend) { return __sync_add_and_fetch(addend, 1); } |
| 240 | inline int atomicDecrementcxx . . $ QTWTF/atomicDecrement(fe996c63fe885c1c).(int volatile* addend) { return __sync_sub_and_fetch(addend, 1); } |
| 241 | |
| 242 | #endif |
| 243 | |
| 244 | class ThreadSafeSharedBasecxx . . $ QTWTF/ThreadSafeSharedBase# : public Noncopyablecxx . . $ Noncopyable# { |
| 245 | public: |
| 246 | ThreadSafeSharedBasecxx . . $ QTWTF/ThreadSafeSharedBase#ThreadSafeSharedBase(d4f767463ce0a6b3).(int initialRefCount = 1) |
| 247 | : m_refCountcxx . . $ QTWTF/ThreadSafeSharedBase#m_refCount.(initialRefCount) |
| 248 | { |
| 249 | } |
| 250 | |
| 251 | void refcxx . . $ QTWTF/ThreadSafeSharedBase#ref(49f6e7a06ebc5aa8).() |
| 252 | { |
| 253 | #if USEcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:55:9`!(LOCKFREE_THREADSAFESHARED) |
| 254 | atomicIncrementcxx . . $ QTWTF/atomicIncrement(fe996c63fe885c1c).(&m_refCountcxx . . $ QTWTF/ThreadSafeSharedBase#m_refCount.); |
| 255 | #else |
| 256 | MutexLocker locker(m_mutex); |
| 257 | ++m_refCount; |
| 258 | #endif |
| 259 | } |
| 260 | |
| 261 | bool hasOneRefcxx . . $ QTWTF/ThreadSafeSharedBase#hasOneRef(c9857a73d68e59ba).() |
| 262 | { |
| 263 | return refCountcxx . . $ QTWTF/ThreadSafeSharedBase#refCount(455f465bc33b4cdf).() == 1; |
| 264 | } |
| 265 | |
| 266 | int refCountcxx . . $ QTWTF/ThreadSafeSharedBase#refCount(455f465bc33b4cdf).() const |
| 267 | { |
| 268 | #if !USEcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:55:9`!(LOCKFREE_THREADSAFESHARED) |
| 269 | MutexLocker locker(m_mutex); |
| 270 | #endif |
| 271 | return static_cast<int const volatile &>(m_refCountcxx . . $ QTWTF/ThreadSafeSharedBase#m_refCount.); |
| 272 | } |
| 273 | |
| 274 | protected: |
| 275 | // Returns whether the pointer should be freed or not. |
| 276 | bool derefBasecxx . . $ QTWTF/ThreadSafeSharedBase#derefBase(c9857a73d68e59ba).() |
| 277 | { |
| 278 | #if USEcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:55:9`!(LOCKFREE_THREADSAFESHARED) |
| 279 | if (atomicDecrementcxx . . $ QTWTF/atomicDecrement(fe996c63fe885c1c).(&m_refCountcxx . . $ QTWTF/ThreadSafeSharedBase#m_refCount.) <= 0) |
| 280 | return true; |
| 281 | #else |
| 282 | int refCount; |
| 283 | { |
| 284 | MutexLocker locker(m_mutex); |
| 285 | --m_refCount; |
| 286 | refCount = m_refCount; |
| 287 | } |
| 288 | if (refCount <= 0) |
| 289 | return true; |
| 290 | #endif |
| 291 | return false; |
| 292 | } |
| 293 | |
| 294 | private: |
| 295 | template<class T> |
| 296 | friend class CrossThreadRefCountedcxx . . $ QTWTF/CrossThreadRefCounted#; |
| 297 | |
| 298 | int m_refCountcxx . . $ QTWTF/ThreadSafeSharedBase#m_refCount.; |
| 299 | #if !USEcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:55:9`!(LOCKFREE_THREADSAFESHARED) |
| 300 | mutable Mutex m_mutex; |
| 301 | #endif |
| 302 | }; |
| 303 | |
| 304 | template<class T> class ThreadSafeSharedcxx . . $ QTWTF/ThreadSafeShared# : public ThreadSafeSharedBasecxx . . $ QTWTF/ThreadSafeSharedBase# { |
| 305 | public: |
| 306 | ThreadSafeSharedcxx . . $ QTWTF/ThreadSafeShared#`ThreadSafeShared<T>`(d4f767463ce0a6b3).(int initialRefCount = 1) |
| 307 | : ThreadSafeSharedBasecxx . . $ QTWTF/ThreadSafeSharedBase#(initialRefCount) |
| 308 | { |
| 309 | } |
| 310 | |
| 311 | void derefcxx . . $ QTWTF/ThreadSafeShared#deref(49f6e7a06ebc5aa8).() |
| 312 | { |
| 313 | if (derefBasecxx . . $ QTWTF/ThreadSafeSharedBase#derefBase(c9857a73d68e59ba).()) |
| 314 | delete static_cast<T*>(this); |
| 315 | } |
| 316 | }; |
| 317 | |
| 318 | // This function must be called from the main thread. It is safe to call it repeatedly. |
| 319 | // Darwin is an exception to this rule: it is OK to call it from any thread, the only requirement is that the calls are not reentrant. |
| 320 | void initializeThreadingcxx . . $ QTWTF/initializeThreading(49f6e7a06ebc5aa8).(); |
| 321 | |
| 322 | void lockAtomicallyInitializedStaticMutexcxx . . $ QTWTF/lockAtomicallyInitializedStaticMutex(49f6e7a06ebc5aa8).(); |
| 323 | void unlockAtomicallyInitializedStaticMutexcxx . . $ QTWTF/unlockAtomicallyInitializedStaticMutex(49f6e7a06ebc5aa8).(); |
| 324 | |
| 325 | } // namespace WTF |
| 326 | |
| 327 | using WTFcxx . . $ `<built-in>:467:9`!::Mutexcxx . . $ Mutex#; |
| 328 | using WTFcxx . . $ `<built-in>:467:9`!::MutexLockercxx . . $ MutexLocker#; |
| 329 | using WTFcxx . . $ QTWTF/::ThreadConditioncxx . . $ QTWTF/ThreadCondition#; |
| 330 | using WTFcxx . . $ `<built-in>:467:9`!::ThreadIdentifiercxx . . $ QTWTF/ThreadIdentifier#; |
| 331 | using WTFcxx . . $ QTWTF/::ThreadSafeSharedcxx . . $ QTWTF/ThreadSafeShared#; |
| 332 | |
| 333 | #if USEcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:55:9`!(LOCKFREE_THREADSAFESHARED) |
| 334 | using WTFcxx . . $ `<built-in>:467:9`!::atomicDecrementcxx . . $ QTWTF/atomicDecrement(fe996c63fe885c1c).; |
| 335 | using WTFcxx . . $ QTWTF/::atomicIncrementcxx . . $ atomicIncrement(fe996c63fe885c1c).; |
| 336 | #endif |
| 337 | |
| 338 | using WTFcxx . . $ `<built-in>:467:9`!::createThreadcxx . . $ QTWTF/createThread(37a5e2dd1ac91d50).; |
| 339 | using WTFcxx . . $ QTWTF/::currentThreadcxx . . $ QTWTF/currentThread(db52760e79bf9054).; |
| 340 | using WTFcxx . . $ QTWTF/::isMainThreadcxx . . $ QTWTF/isMainThread(c9857a73d68e59ba).; |
| 341 | using WTFcxx . . $ QTWTF/::detachThreadcxx . . $ QTWTF/detachThread(cb2f890c2fdad230).; |
| 342 | using WTFcxx . . $ QTWTF/::waitForThreadCompletioncxx . . $ waitForThreadCompletion(83ff549750eb75a).; |
| 343 | |
| 344 | #endif // Threading_h |