I am using std::shared_timed_mutex::try_lock_for. And I encounter the problem exactly as stated at cppreference.com which says:
As with try_lock(), this function is allowed to fail spuriously and return false even if the mutex was not locked by any other thread at some point during timeout_duration.
The lock in my case sometimes returns false before the time has elapsed.
Question:
Is there a standard workaround for this? Something other than a std::shared_timed_mutex
that I can use from C++ std library?
Or the only workaround is to write a custom mutex of my won like mentioned here? Are there any other better custom solutions?
Environment:
I am using gcc 7.3 on Linux
Aucun commentaire:
Enregistrer un commentaire