Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. class Class {
  2. public:
  3.     void method0() {
  4.         std::unique_lock<std::mutex>(m_mutex);
  5.         // Do something
  6.     }
  7.  
  8.     void method1() {
  9.         std::unique_lock<std::mutex>{m_mutex};
  10.         // Do something
  11.     }
  12.  
  13. private:
  14.     std::mutex m_mutex;
  15. };
  16.  
  17. // Thread 0:
  18. while(true) cls.method0();
  19.  
  20. // Thread 1:
  21. while(true) cls.method1();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement