c++ - How do you use std::atomic to achieve thread-safety without locking mutexes? -
i know, in situations can avoid having lock mutexes (std::mutex) using std::atomic, increasing performance.
can name situation this, , preferably show example code on how (how use std::atomic)?
also, when lock mutex, performance degrades because other threads unable continue doing work period of time mutex locked. issue mutex? mean, is locking/unlocking mutex expensive operation or it's mentioned above?
Comments
Post a Comment