mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 944387 - Remove the dead OS X Mutex implementation from the profiler; r=BenWa
This commit is contained in:
parent
6265857bfe
commit
f0d70d6191
@ -56,39 +56,6 @@ Sampler *SamplerRegistry::sampler = NULL;
|
||||
// a pointer.
|
||||
static const pthread_t kNoThread = (pthread_t) 0;
|
||||
|
||||
class MacOSMutex : public ::Mutex {
|
||||
public:
|
||||
MacOSMutex() {
|
||||
pthread_mutexattr_t attr;
|
||||
pthread_mutexattr_init(&attr);
|
||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
|
||||
pthread_mutex_init(&mutex_, &attr);
|
||||
}
|
||||
|
||||
virtual ~MacOSMutex() { pthread_mutex_destroy(&mutex_); }
|
||||
|
||||
virtual int Lock() { return pthread_mutex_lock(&mutex_); }
|
||||
virtual int Unlock() { return pthread_mutex_unlock(&mutex_); }
|
||||
|
||||
virtual bool TryLock() {
|
||||
int result = pthread_mutex_trylock(&mutex_);
|
||||
// Return false if the lock is busy and locking failed.
|
||||
if (result == EBUSY) {
|
||||
return false;
|
||||
}
|
||||
ASSERT(result == 0); // Verify no other errors.
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
pthread_mutex_t mutex_;
|
||||
};
|
||||
|
||||
|
||||
::Mutex* OS::CreateMutex() {
|
||||
return new MacOSMutex();
|
||||
}
|
||||
|
||||
void OS::Sleep(int milliseconds) {
|
||||
usleep(1000 * milliseconds);
|
||||
}
|
||||
@ -297,8 +264,6 @@ class SamplerThread : public Thread {
|
||||
int intervalMicro_;
|
||||
//RuntimeProfilerRateLimiter rate_limiter_;
|
||||
|
||||
// Protects the process wide state below.
|
||||
static ::Mutex* mutex_;
|
||||
static SamplerThread* instance_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(SamplerThread);
|
||||
|
@ -109,28 +109,6 @@ class Mutex {
|
||||
virtual bool TryLock() = 0;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ScopedLock
|
||||
//
|
||||
// Stack-allocated ScopedLocks provide block-scoped locking and
|
||||
// unlocking of a mutex.
|
||||
class ScopedLock {
|
||||
public:
|
||||
explicit ScopedLock(Mutex* mutex): mutex_(mutex) {
|
||||
ASSERT(mutex_ != NULL);
|
||||
mutex_->Lock();
|
||||
}
|
||||
~ScopedLock() {
|
||||
mutex_->Unlock();
|
||||
}
|
||||
|
||||
private:
|
||||
Mutex* mutex_;
|
||||
DISALLOW_COPY_AND_ASSIGN(ScopedLock);
|
||||
};
|
||||
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// OS
|
||||
//
|
||||
@ -147,10 +125,6 @@ class OS {
|
||||
// Sleep for a number of microseconds.
|
||||
static void SleepMicro(const int microseconds);
|
||||
|
||||
// Factory method for creating platform dependent Mutex.
|
||||
// Please use delete to reclaim the storage for the returned Mutex.
|
||||
static Mutex* CreateMutex();
|
||||
|
||||
// On supported platforms, setup a signal handler which would start
|
||||
// the profiler.
|
||||
#if defined(ANDROID)
|
||||
|
Loading…
Reference in New Issue
Block a user