https://bugs.winehq.org/show_bug.cgi?id=54979
--- Comment #13 from Zeb Figura z.figura12@gmail.com --- (In reply to John Nagle from comment #12)
There is an outer level of spinlock.
See summary here: https://forum.winehq.org/viewtopic.php?t=37688
Ah. That's not really a spinlock, though. The CS is a hybrid lock, but not a true spinlock, and we don't use the spin count for the heap anyway, so it's not even a hybrid lock.
As far as I can tell, this is not fine-grained locking. It's just one big lock for the whole heap.
That's true, if making heap locking more fine-grained would be enough then that's an alternate solution. I don't really have the time/interest to implement that myself, though.
That should be a short spinlock, which, if it times out, causes a kernel-level lock and block.
It is. In fact, it's not even the spinlock; we just block immediately. The problem is that in order to block we need to spin-lock the internal wait queue.
There are other ways to do a kernel wait, but they come with a significant performance cost.