vendredi 11 septembre 2015

Fair Reentrant Lock C++

I'm working on a program which suffer from starvation when one thread is doing more work than another. Critical section is protected by a reentrant QMutex, which is not fair.

In Java, you can specify a fairness parameter for a lock. Does C++,(or boost libraries) have any fair reentrant lock available? Preferably up to C++11.

I did some research before, there is shared_lock in boost, but I do not need a read/write lock. Just a lock which will guarantee that each thread has equal chances to enter the critical section.

Thank you very much.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire