diff options
author | chron@chromium.org <chron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-28 23:36:12 +0000 |
---|---|---|
committer | chron@chromium.org <chron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-28 23:36:12 +0000 |
commit | 46bc9fb98bbd98ef7f248fa925c56fb7216d4c61 (patch) | |
tree | 20ccbd02e3b381cf9a216926e23c85bd7d6b1152 | |
parent | c0cd0ab81f0ba15406e57c210eec0e58a9695b28 (diff) | |
download | chromium_src-46bc9fb98bbd98ef7f248fa925c56fb7216d4c61.zip chromium_src-46bc9fb98bbd98ef7f248fa925c56fb7216d4c61.tar.gz chromium_src-46bc9fb98bbd98ef7f248fa925c56fb7216d4c61.tar.bz2 |
Remove unused pthread helpers. Looks like we don't use pthread_rw locks at all.
This CL does not complete 19391, only removes the pthread dep.
BUG=19391
Review URL: http://codereview.chromium.org/231005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27432 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/sync/util/pthread_helpers.h | 127 |
1 files changed, 0 insertions, 127 deletions
diff --git a/chrome/browser/sync/util/pthread_helpers.h b/chrome/browser/sync/util/pthread_helpers.h index 3886b7f..7af08f4 100644 --- a/chrome/browser/sync/util/pthread_helpers.h +++ b/chrome/browser/sync/util/pthread_helpers.h @@ -19,70 +19,6 @@ typedef pthread_t thread_handle; // the caller must CloseHandle(). thread_handle CreatePThread(void* (*start)(void* payload), void* parameter); -class PThreadRWLock { - public: - inline PThreadRWLock() { - int result = pthread_rwlock_init(&rwlock_, 0); - DCHECK_EQ(0, result); - } - ~PThreadRWLock() { - int result = pthread_rwlock_destroy(&rwlock_); - DCHECK_EQ(0, result); - } - pthread_rwlock_t rwlock_; - - DISALLOW_COPY_AND_ASSIGN(PThreadRWLock); -}; - -// ScopedReadLock attempts to acquire a write lock in its constructor and then -// releases it in its destructor. -class ScopedWriteLock { - public: - explicit ScopedWriteLock(pthread_rwlock_t* rwlock) : rwlock_(rwlock) { - int result = pthread_rwlock_wrlock(rwlock_); - DCHECK_EQ(0, result); - } - - explicit ScopedWriteLock(PThreadRWLock* rwlock) : rwlock_(&rwlock->rwlock_) { - int result = pthread_rwlock_wrlock(rwlock_); - DCHECK_EQ(0, result); - } - - ~ScopedWriteLock() { - int result = pthread_rwlock_unlock(rwlock_); - DCHECK_EQ(0, result); - } - - protected: - pthread_rwlock_t* rwlock_; - private: - DISALLOW_COPY_AND_ASSIGN(ScopedWriteLock); -}; - -// ScopedReadLock attempts to acquire a read lock in its constructor and then -// releases it in its destructor. -class ScopedReadLock { - public: - explicit ScopedReadLock(pthread_rwlock_t* rwlock) : rwlock_(rwlock) { - int result = pthread_rwlock_rdlock(rwlock_); - DCHECK_EQ(0, result); - } - - explicit ScopedReadLock(PThreadRWLock* rwlock) : rwlock_(&rwlock->rwlock_) { - int result = pthread_rwlock_rdlock(rwlock_); - DCHECK_EQ(0, result); - } - - ~ScopedReadLock() { - int result = pthread_rwlock_unlock(rwlock_); - DCHECK_EQ(0, result); - } - protected: - pthread_rwlock_t* rwlock_; - private: - DISALLOW_COPY_AND_ASSIGN(ScopedReadLock); -}; - template <typename LockType> class PThreadScopedLock { public: @@ -162,46 +98,6 @@ class PThreadMutex { DISALLOW_COPY_AND_ASSIGN(PThreadMutex); }; -class PThreadMutexAttr { - public: - pthread_mutexattr_t attr; - inline PThreadMutexAttr(int type) { - pthread_mutexattr_init(&attr); - pthread_mutexattr_settype(&attr, type); - } - inline ~PThreadMutexAttr() { - pthread_mutexattr_destroy(&attr); - } - private: - DISALLOW_COPY_AND_ASSIGN(PThreadMutexAttr); -}; - -class PThreadRecursiveMutex : public PThreadMutex { - public: - inline PThreadRecursiveMutex() : PThreadMutex(recursive_attr()) {} - private: - static inline pthread_mutexattr_t* recursive_attr() { - static PThreadMutexAttr recursive(PTHREAD_MUTEX_RECURSIVE); - return &recursive.attr; - } - DISALLOW_COPY_AND_ASSIGN(PThreadRecursiveMutex); -}; - - -class PThreadScopedDisabledCancellation { - public: - inline PThreadScopedDisabledCancellation() { - pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &old_cancel_state_); - } - inline ~PThreadScopedDisabledCancellation() { - pthread_setcancelstate(old_cancel_state_, NULL); - } - private: - int old_cancel_state_; - - DISALLOW_COPY_AND_ASSIGN(PThreadScopedDisabledCancellation); -}; - class PThreadCondVar { public: inline PThreadCondVar() { @@ -226,29 +122,6 @@ class PThreadCondVar { DISALLOW_COPY_AND_ASSIGN(PThreadCondVar); }; -template <typename ValueType> -class PThreadThreadVar { - public: - PThreadThreadVar(void (*destructor)(void* payload)) { - int result = pthread_key_create(&thread_key_, destructor); - DCHECK_EQ(0, result); - } - ~PThreadThreadVar() { - int result = pthread_key_delete(thread_key_); - DCHECK_EQ(0, result); - } - void SetValue(ValueType value) { - int result = pthread_setspecific(thread_key_, static_cast<void*>(value)); - DCHECK_EQ(0, result); - } - ValueType GetValue() { - return static_cast<ValueType>(pthread_getspecific(thread_key_)); - } - private: - pthread_key_t thread_key_; - DISALLOW_COPY_AND_ASSIGN(PThreadThreadVar); -}; - // Returns the absolute time ms milliseconds from now. Useful for passing // result to pthread_cond_timedwait(). struct timespec GetPThreadAbsoluteTime(uint32 ms_from_now); |