diff options
Diffstat (limited to 'base/synchronization')
-rw-r--r-- | base/synchronization/condition_variable_posix.cc | 2 | ||||
-rw-r--r-- | base/synchronization/condition_variable_win.cc | 2 | ||||
-rw-r--r-- | base/synchronization/lock_impl.h | 8 | ||||
-rw-r--r-- | base/synchronization/lock_impl_posix.cc | 12 | ||||
-rw-r--r-- | base/synchronization/lock_impl_win.cc | 10 |
5 files changed, 17 insertions, 17 deletions
diff --git a/base/synchronization/condition_variable_posix.cc b/base/synchronization/condition_variable_posix.cc index 93b35ed..92b479e 100644 --- a/base/synchronization/condition_variable_posix.cc +++ b/base/synchronization/condition_variable_posix.cc @@ -15,7 +15,7 @@ namespace base { ConditionVariable::ConditionVariable(Lock* user_lock) - : user_mutex_(user_lock->lock_.os_lock()) + : user_mutex_(user_lock->lock_.native_handle()) #if !defined(NDEBUG) , user_lock_(user_lock) #endif diff --git a/base/synchronization/condition_variable_win.cc b/base/synchronization/condition_variable_win.cc index bf0d5f3..927362a 100644 --- a/base/synchronization/condition_variable_win.cc +++ b/base/synchronization/condition_variable_win.cc @@ -97,7 +97,7 @@ void WinVistaCondVar::Wait() { void WinVistaCondVar::TimedWait(const TimeDelta& max_time) { base::ThreadRestrictions::AssertWaitAllowed(); DWORD timeout = static_cast<DWORD>(max_time.InMilliseconds()); - CRITICAL_SECTION* cs = user_lock_.lock_.os_lock(); + CRITICAL_SECTION* cs = user_lock_.lock_.native_handle(); #if !defined(NDEBUG) user_lock_.CheckHeldAndUnmark(); diff --git a/base/synchronization/lock_impl.h b/base/synchronization/lock_impl.h index 0b04167..42e2f99 100644 --- a/base/synchronization/lock_impl.h +++ b/base/synchronization/lock_impl.h @@ -25,9 +25,9 @@ namespace internal { class BASE_EXPORT LockImpl { public: #if defined(OS_WIN) - typedef CRITICAL_SECTION OSLockType; + typedef CRITICAL_SECTION NativeHandle; #elif defined(OS_POSIX) - typedef pthread_mutex_t OSLockType; + typedef pthread_mutex_t NativeHandle; #endif LockImpl(); @@ -47,10 +47,10 @@ class BASE_EXPORT LockImpl { // Return the native underlying lock. // TODO(awalker): refactor lock and condition variables so that this is // unnecessary. - OSLockType* os_lock() { return &os_lock_; } + NativeHandle* native_handle() { return &native_handle_; } private: - OSLockType os_lock_; + NativeHandle native_handle_; DISALLOW_COPY_AND_ASSIGN(LockImpl); }; diff --git a/base/synchronization/lock_impl_posix.cc b/base/synchronization/lock_impl_posix.cc index 8615876..5619ada 100644 --- a/base/synchronization/lock_impl_posix.cc +++ b/base/synchronization/lock_impl_posix.cc @@ -20,34 +20,34 @@ LockImpl::LockImpl() { DCHECK_EQ(rv, 0) << ". " << strerror(rv); rv = pthread_mutexattr_settype(&mta, PTHREAD_MUTEX_ERRORCHECK); DCHECK_EQ(rv, 0) << ". " << strerror(rv); - rv = pthread_mutex_init(&os_lock_, &mta); + rv = pthread_mutex_init(&native_handle_, &mta); DCHECK_EQ(rv, 0) << ". " << strerror(rv); rv = pthread_mutexattr_destroy(&mta); DCHECK_EQ(rv, 0) << ". " << strerror(rv); #else // In release, go with the default lock attributes. - pthread_mutex_init(&os_lock_, NULL); + pthread_mutex_init(&native_handle_, NULL); #endif } LockImpl::~LockImpl() { - int rv = pthread_mutex_destroy(&os_lock_); + int rv = pthread_mutex_destroy(&native_handle_); DCHECK_EQ(rv, 0) << ". " << strerror(rv); } bool LockImpl::Try() { - int rv = pthread_mutex_trylock(&os_lock_); + int rv = pthread_mutex_trylock(&native_handle_); DCHECK(rv == 0 || rv == EBUSY) << ". " << strerror(rv); return rv == 0; } void LockImpl::Lock() { - int rv = pthread_mutex_lock(&os_lock_); + int rv = pthread_mutex_lock(&native_handle_); DCHECK_EQ(rv, 0) << ". " << strerror(rv); } void LockImpl::Unlock() { - int rv = pthread_mutex_unlock(&os_lock_); + int rv = pthread_mutex_unlock(&native_handle_); DCHECK_EQ(rv, 0) << ". " << strerror(rv); } diff --git a/base/synchronization/lock_impl_win.cc b/base/synchronization/lock_impl_win.cc index bb8a23d..fbc1bdd 100644 --- a/base/synchronization/lock_impl_win.cc +++ b/base/synchronization/lock_impl_win.cc @@ -10,26 +10,26 @@ namespace internal { LockImpl::LockImpl() { // The second parameter is the spin count, for short-held locks it avoid the // contending thread from going to sleep which helps performance greatly. - ::InitializeCriticalSectionAndSpinCount(&os_lock_, 2000); + ::InitializeCriticalSectionAndSpinCount(&native_handle_, 2000); } LockImpl::~LockImpl() { - ::DeleteCriticalSection(&os_lock_); + ::DeleteCriticalSection(&native_handle_); } bool LockImpl::Try() { - if (::TryEnterCriticalSection(&os_lock_) != FALSE) { + if (::TryEnterCriticalSection(&native_handle_) != FALSE) { return true; } return false; } void LockImpl::Lock() { - ::EnterCriticalSection(&os_lock_); + ::EnterCriticalSection(&native_handle_); } void LockImpl::Unlock() { - ::LeaveCriticalSection(&os_lock_); + ::LeaveCriticalSection(&native_handle_); } } // namespace internal |