Commit 3068f476 authored by Luca Boccassi's avatar Luca Boccassi Committed by GitHub

Merge pull request #2099 from a4z/master

Problem: socket_base uses macros for mutex lock and unlock
parents fb34c323 9201009f
......@@ -181,6 +181,33 @@ namespace zmq
scoped_lock_t (const scoped_lock_t&);
const scoped_lock_t &operator = (const scoped_lock_t&);
};
struct scoped_optional_lock_t
{
scoped_optional_lock_t (mutex_t* mutex_)
: mutex (mutex_)
{
if(mutex != 0)
mutex->lock ();
}
~scoped_optional_lock_t ()
{
if(mutex != 0)
mutex->unlock ();
}
private:
mutex_t* mutex;
// Disable copy construction and assignment.
scoped_optional_lock_t (const scoped_lock_t&);
const scoped_optional_lock_t &operator = (const scoped_lock_t&);
};
}
#endif
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment