Commit 4eac7e3e authored by danielkr's avatar danielkr

Add scoped_lock_t syntactic sugar

parent 87c84a25
......@@ -128,4 +128,30 @@ namespace zmq
#endif
namespace zmq
{
struct scoped_lock_t
{
scoped_lock_t (mutex_t& mutex_)
: mutex (mutex_)
{
mutex.lock ();
}
~scoped_lock_t ()
{
mutex.unlock ();
}
private:
mutex_t& mutex;
// Disable copy construction and assignment.
scoped_lock_t (const scoped_lock_t&);
const scoped_lock_t &operator = (const scoped_lock_t&);
};
}
#endif
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