diff options
author | Ben Murdoch <benm@google.com> | 2009-08-11 17:01:47 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2009-08-11 18:21:02 +0100 |
commit | 0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5 (patch) | |
tree | 2943df35f62d885c89d01063cc528dd73b480fea /JavaScriptCore/wtf/Threading.h | |
parent | 7e7a70bfa49a1122b2597a1e6367d89eb4035eca (diff) | |
download | external_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.zip external_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.tar.gz external_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.tar.bz2 |
Merge in WebKit r47029.
Diffstat (limited to 'JavaScriptCore/wtf/Threading.h')
-rw-r--r-- | JavaScriptCore/wtf/Threading.h | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/JavaScriptCore/wtf/Threading.h b/JavaScriptCore/wtf/Threading.h index e562f35..66e0d2a 100644 --- a/JavaScriptCore/wtf/Threading.h +++ b/JavaScriptCore/wtf/Threading.h @@ -59,7 +59,9 @@ #ifndef Threading_h #define Threading_h -#if PLATFORM(WIN_CE) +#include "Platform.h" + +#if PLATFORM(WINCE) #include <windows.h> #endif @@ -67,7 +69,7 @@ #include <wtf/Locker.h> #include <wtf/Noncopyable.h> -#if PLATFORM(WIN_OS) && !PLATFORM(WIN_CE) +#if PLATFORM(WIN_OS) && !PLATFORM(WINCE) #include <windows.h> #elif PLATFORM(DARWIN) #include <libkern/OSAtomic.h> @@ -128,18 +130,22 @@ void detachThread(ThreadIdentifier); #if USE(PTHREADS) typedef pthread_mutex_t PlatformMutex; +typedef pthread_rwlock_t PlatformReadWriteLock; typedef pthread_cond_t PlatformCondition; #elif PLATFORM(GTK) typedef GOwnPtr<GMutex> PlatformMutex; +typedef void* PlatformReadWriteLock; // FIXME: Implement. typedef GOwnPtr<GCond> PlatformCondition; #elif PLATFORM(QT) typedef QT_PREPEND_NAMESPACE(QMutex)* PlatformMutex; +typedef void* PlatformReadWriteLock; // FIXME: Implement. typedef QT_PREPEND_NAMESPACE(QWaitCondition)* PlatformCondition; #elif PLATFORM(WIN_OS) struct PlatformMutex { CRITICAL_SECTION m_internalMutex; size_t m_recursionCount; }; +typedef void* PlatformReadWriteLock; // FIXME: Implement. struct PlatformCondition { size_t m_waitersGone; size_t m_waitersBlocked; @@ -153,10 +159,11 @@ struct PlatformCondition { }; #else typedef void* PlatformMutex; +typedef void* PlatformReadWriteLock; typedef void* PlatformCondition; #endif -class Mutex : Noncopyable { +class Mutex : public Noncopyable { public: Mutex(); ~Mutex(); @@ -173,7 +180,24 @@ private: typedef Locker<Mutex> MutexLocker; -class ThreadCondition : Noncopyable { +class ReadWriteLock : public Noncopyable { +public: + ReadWriteLock(); + ~ReadWriteLock(); + + void readLock(); + bool tryReadLock(); + + void writeLock(); + bool tryWriteLock(); + + void unlock(); + +private: + PlatformReadWriteLock m_readWriteLock; +}; + +class ThreadCondition : public Noncopyable { public: ThreadCondition(); ~ThreadCondition(); @@ -192,7 +216,7 @@ private: #if PLATFORM(WIN_OS) #define WTF_USE_LOCKFREE_THREADSAFESHARED 1 -#if COMPILER(MINGW) || COMPILER(MSVC7) || PLATFORM(WIN_CE) +#if COMPILER(MINGW) || COMPILER(MSVC7) || PLATFORM(WINCE) inline void atomicIncrement(int* addend) { InterlockedIncrement(reinterpret_cast<long*>(addend)); } inline int atomicDecrement(int* addend) { return InterlockedDecrement(reinterpret_cast<long*>(addend)); } #else @@ -219,7 +243,7 @@ inline int atomicDecrement(int volatile* addend) { return __gnu_cxx::__exchange_ #endif -class ThreadSafeSharedBase : Noncopyable { +class ThreadSafeSharedBase : public Noncopyable { public: ThreadSafeSharedBase(int initialRefCount = 1) : m_refCount(initialRefCount) |