As known if thread-1 locks the std::mutex
and occurs switch of thread-1, and if at this time many threads (2, 3, 4 ...) want to lock this mutex, then all these threads will locked and will be waiting for switch-on thread-1.
The solution to this is to use lock-free algorithms. But if requre to use a mutex, that is some solution to avoid such a situation?
-
How can I find out in advance for 100 cycles before the imminent switching of thread?
-
Or how can I raise an exception in advance for 100 cycles before switching the flow on Linux x86_64?
-
Or how can I to make continue work of thread for some time (100 cycles)?
Aucun commentaire:
Enregistrer un commentaire