Guest User

Untitled

a guest
Feb 23rd, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. // version 1 - unlock then notify.
  2. void release(int address = 1)
  3. {
  4. {
  5. std::lock_guard<std::mutex> lk(_address_mutex);
  6. _address = address;
  7. }
  8. _cv.notify_all();
  9. }
  10.  
  11. // version 2 - notify then unlock
  12. void release(int address = 1)
  13. {
  14. std::lock_guard<std::mutex> lk(_address_mutex);
  15. _address = address;
  16. _cv.notify_all();
  17. }
Add Comment
Please, Sign In to add comment