Is to ok to combine all three variables into one struct?
struct lock_struct
{
std::mutex mutex;
std::conditional_variable cv;
bool flag;
};
Are there any hidden synchronization problems with this approach? I do not intend to modify struct itself, only it's fields.
By the way, should I use bool or std::atomic<bool> when dealing with std::condition_variable's flag?
Aucun commentaire:
Enregistrer un commentaire