On Mon Jun 17 17:07:40 2024 +0000, Elizabeth Figura wrote:
Without doing any research myself... the other side is going to try to enter the logic immediately [within SleepConditionVariableCS()] assuming it's waiting, and I think usually wakes are fast enough [at least on Linux] that the other thread will generally start executing before you even return from the wake function. Besides a poorly communicated warning that doesn't apply here, the first comment in [1] also claims that it defeats a "wait morphing" optimization, where instead of actually waking threads they're just moved from the CV waitqueue to the mutex wait queue [if their associated mutex is locked [by the calling thread?]]. That's not something we currently implement in Wine; it may be possible to implement later though... [1] https://stackoverflow.com/questions/52503361/unlock-the-mutex-after-conditio...
I do see a small but measurable performance gain in HZD. It's only 0.7%, but that shoud be weighed that against the very simple change needed to gain it.