Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // version 1 - unlock then notify.
- void release(int address = 1)
- {
- {
- std::lock_guard<std::mutex> lk(_address_mutex);
- _address = address;
- }
- _cv.notify_all();
- }
- // version 2 - notify then unlock
- void release(int address = 1)
- {
- std::lock_guard<std::mutex> lk(_address_mutex);
- _address = address;
- _cv.notify_all();
- }
Add Comment
Please, Sign In to add comment