By try_lock*, I take to mean try_lock(), try_lock_for(), and try_lock_until(). According to cppreference, all three methods may just fail spuriously. Following is quoted from the description for try_lock_for()
As with
try_lock(), this function is allowed to fail spuriously and returnfalseeven if the mutex was not locked by any other thread at some point duringtimeout_duration.
I know that spurious wakeup may happen with std::condition_variable and the rationale behind it. But, what is the case with a mutex?
Aucun commentaire:
Enregistrer un commentaire