Summary: add trylock support to the Mutex class
Reviewed By: mcslee
Test Plan: added trylock mutexes to foreman, walked through them in gdb
(behaved correctly) and then ran an entire sweep (behaved correctly)
Notes: slee ftw
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665204
13f79535-47bb-0310-9956-
ffa450edef68
void lock() const { pthread_mutex_lock(&pthread_mutex_); }
+ bool trylock() const { return (0 == pthread_mutex_trylock(&pthread_mutex_)); }
+
void unlock() const { pthread_mutex_unlock(&pthread_mutex_); }
private:
void Mutex::lock() const { impl_->lock(); }
+bool Mutex::trylock() const { return impl_->trylock(); }
+
void Mutex::unlock() const { impl_->unlock(); }
/**
Mutex();
virtual ~Mutex() {}
virtual void lock() const;
+ virtual bool trylock() const;
virtual void unlock() const;
private: