Tuesday, 22 May 2012

Extraneous call to unlock on scoped_lock

In the following blogpost: http://www.justsoftwaresolutions.co.uk/threading/implementing-a-thread-safe-queue-using-condition-variables.html There is a 'push' method defined as follows: void push(Data const& data) { boost::mutex::scoped_lock lock(the_mutex); the_queue.push(data); lock.unlock(); the_condition_variable.notify_one(); } My questions are: why is there an explicit '

No comments:

Post a Comment