On Mon Jun 17 11:12:08 2024 +0000, Giovanni Mascellani wrote:
I'm not against this. The opinions on whether that's good for performance varies across the internet and the answer ultimately depends on the underlying implementation, which Zeb probably knows better than me. But did you measure an actual performance gain with that change?
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...