c++ - boost scoped unlock for a mutex -
i have code looks like:
boost::mutex::scoped_lock lck(mqueuemutex); while (true) { ... // unlock queue while exec job lck.unlock(); ... // lock queue 1 time again lck.lock(); } i looking this:
boost::mutex::scoped_lock lock(mqueuemutex); while (true) { ... // unlock queue while exec job { boost::mutex::scoped_unlock unlock(lock); ... } } i sure have seen before ... or @ to the lowest degree give-and-take it, can't find it.
you looking boost.threads reverse lock:
reverse_lock reverse operations of lock: provide raii-style, unlocks lock @ construction time , lock @ destruction time. in addition, transfer ownership temporarily, mutex can not locked using lock.
c++ multithreading boost
No comments:
Post a Comment