This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [v3] mutex vs. cstdatomic


Chris Fairles:
Keep note that <mutex>'s unique_lock<> should be using atomic_bool for
its internal _M_owns variable so <mutex> will eventually need to
include <cstdatomic>

I'm not sure. The only reason you'd want an atomic_bool for _M_owns is to make unique_lock tolerate data races. But it makes little sense to access an unique_lock from a thread which did not create it since only the thread that locked the mutex can unlock it.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]