diff options
Diffstat (limited to 'base/criticalsection.h')
-rw-r--r-- | base/criticalsection.h | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/base/criticalsection.h b/base/criticalsection.h index 92745ce..c6ffbc0 100644 --- a/base/criticalsection.h +++ b/base/criticalsection.h @@ -29,7 +29,6 @@ #define TALK_BASE_CRITICALSECTION_H__ #include "talk/base/constructormagic.h" -#include "webrtc/system_wrappers/interface/thread_annotations.h" #ifdef WIN32 #include "talk/base/win32.h" @@ -52,7 +51,7 @@ namespace talk_base { #ifdef WIN32 -class LOCKABLE CriticalSection { +class CriticalSection { public: CriticalSection() { InitializeCriticalSection(&crit_); @@ -62,18 +61,18 @@ class LOCKABLE CriticalSection { ~CriticalSection() { DeleteCriticalSection(&crit_); } - void Enter() EXCLUSIVE_LOCK_FUNCTION() { + void Enter() { EnterCriticalSection(&crit_); TRACK_OWNER(thread_ = GetCurrentThreadId()); } - bool TryEnter() EXCLUSIVE_TRYLOCK_FUNCTION(true) { + bool TryEnter() { if (TryEnterCriticalSection(&crit_) != FALSE) { TRACK_OWNER(thread_ = GetCurrentThreadId()); return true; } return false; } - void Leave() UNLOCK_FUNCTION() { + void Leave() { TRACK_OWNER(thread_ = 0); LeaveCriticalSection(&crit_); } @@ -89,7 +88,7 @@ class LOCKABLE CriticalSection { #endif // WIN32 #ifdef POSIX -class LOCKABLE CriticalSection { +class CriticalSection { public: CriticalSection() { pthread_mutexattr_t mutex_attribute; @@ -102,18 +101,18 @@ class LOCKABLE CriticalSection { ~CriticalSection() { pthread_mutex_destroy(&mutex_); } - void Enter() EXCLUSIVE_LOCK_FUNCTION() { + void Enter() { pthread_mutex_lock(&mutex_); TRACK_OWNER(thread_ = pthread_self()); } - bool TryEnter() EXCLUSIVE_TRYLOCK_FUNCTION(true) { + bool TryEnter() { if (pthread_mutex_trylock(&mutex_) == 0) { TRACK_OWNER(thread_ = pthread_self()); return true; } return false; } - void Leave() UNLOCK_FUNCTION() { + void Leave() { TRACK_OWNER(thread_ = 0); pthread_mutex_unlock(&mutex_); } @@ -129,13 +128,13 @@ class LOCKABLE CriticalSection { #endif // POSIX // CritScope, for serializing execution through a scope. -class SCOPED_LOCKABLE CritScope { +class CritScope { public: - explicit CritScope(CriticalSection *pcrit) EXCLUSIVE_LOCK_FUNCTION(pcrit) { + explicit CritScope(CriticalSection *pcrit) { pcrit_ = pcrit; pcrit_->Enter(); } - ~CritScope() UNLOCK_FUNCTION() { + ~CritScope() { pcrit_->Leave(); } private: |