3 ms·
Its much more than timeouts. Here’s the killer use case outside wine: - program with fine grained locks - you have an algorithm that needs to acquire N of tho
by pizlonator 7y ago
Its much more than timeouts. Here’s the killer use case outside wine:
- program with fine grained locks
- you have an algorithm that needs to acquire N of those locks, one at a time, and can do it in any order
In that case, you really want to:
- first attempt fast path locking on all of them in any order
- if that fails tell the kernel about all of the locks you are waiting on at once.
This means that you will become unblocked as soon as any lock becomes available.
That will make your program run faster. Therefore, it’s a good improvement for futexes in my opinion.
- pjc50 7y agoYou can't acquire locks in any order, that's a recipe for deadlock when one process has acquired half the locks and another has the different half, resulting in them waiting on each other. Use of WaitForMultipleObjects is more usually for completion of tasks, in the way that win32 "overlapped" works.
- pizlonator 7y agoYou absolutely can try to acquire locks in any order if you are just trying to find the first one that is available. Remember, the algorithm in my example is one where you hold locks one at a time. You can acquire locks in any order if you hold them one at a time. Also my example is intentionally not about wine or win32. I’m articulating why this interface is independently valuable.
- deleted 7y ago[deleted]