Open Mooophy opened 9 years ago
std::unique_lock
can always replace std::lock_gurad
?
IMO, std::unique_lock
can only lock once at the constructor, and unlock at the destructor.
Not sure.. check line 27 and 34. It was not in a constructor, but works pretty well.
I found a few Q&A about them on SO, but no time to read, so just left a mark here for checking back later.
the only refer to once, not constructor. std::unique_lock
is the common sense lock that we often talk about.
Oh .. I get you. I'm gonna try a little bit more to test them~
std::unique_lock
vsstd::lock_guard