std::unique_lock or std::lock_guard?

后端 未结 7 588
天命终不由人
天命终不由人 2020-11-29 14:17

I have two use cases.

A. I want to synchronise access to a queue for two threads.

B. I want to synchronise access to a queue for two threads and use a conditio

7条回答
  •  北荒
    北荒 (楼主)
    2020-11-29 15:06

    One missing difference is: std::unique_lock can be moved but std::lock_guard can't be moved.

    Note: Both cant be copied.

提交回复
热议问题