vendredi 30 novembre 2018

Use cases of recursive_mutex, timed_mutex, recursive_timed_mutex

I understand that the template parameter of std::lock_guard is representing anything BasicLockable type.

That makes the following code block valid.

std::recursive_timed_mutex m;
//.
//.
//.
std::lock_guard<std::recursive_timed_mutex> guard(m);

I have rarely seen a BasicLockable other than std::mutex is used, though. This makes me think std::mutex is just for general mutual exclusion usage. Even tough their definitions are out there, I wanted to look for use cases of other BasicLockable s but couldn't find much.

So my question is, what are the use cases of recursive_mutex/timed_mutex/recursive_timed_mutex?

Aucun commentaire:

Enregistrer un commentaire