Questions tagged [unique-lock]

The class std::unique_lock is a general-purpose mutex ownership wrapper allowing deferred locking, time-constrained attempts at locking, recursive locking, transfer of lock ownership, and use with condition variables.

32 questions
-1
votes
1 answer

unique_lock.lock() causes abort in C++

I am learning C++ threads and i don't understand unique_lock mechanism very well. I reed This Link with Conditional variable, and more examples here but still I have my confusions: 1- So my question clearly is, doesn't unique_lock protect the mutual…
Azzurro94
  • 479
  • 1
  • 7
  • 19
-1
votes
1 answer

Difficulty with unique_lock in simple Producer & Consumer

I have written a very simple Producer/Consumer based out of C++11 notes and unable to figure out why the unique_lock() does not release the lock when goes out of scope. struct Message{ Message(int x):data(x){cout<<"+";} int…
cpp11dev
  • 417
  • 6
  • 13
1 2
3