Landing patch for Timur Iskhodzhanov.

Reviewed at http://codereview.chromium.org/160099

The original MacOSMutex constructor makes data race detectors a little
bit crazy. Also, the new version is simpler and easier to understand.



git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2535 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
iposva@chromium.org 2009-07-27 05:31:30 +00:00
parent 500e10b648
commit d573e3b39d

View File

@ -424,14 +424,10 @@ class MacOSMutex : public Mutex {
public: public:
MacOSMutex() { MacOSMutex() {
// For some reason the compiler doesn't allow you to write
// "this->mutex_ = PTHREAD_..." directly on mac.
pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;
pthread_mutexattr_t attr; pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr); pthread_mutexattr_init(&attr);
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
pthread_mutex_init(&m, &attr); pthread_mutex_init(&mutex_, &attr);
mutex_ = m;
} }
~MacOSMutex() { pthread_mutex_destroy(&mutex_); } ~MacOSMutex() { pthread_mutex_destroy(&mutex_); }