What's the purpose of patches 1-3?
To prepare the objects to later use inproc syncs isntead of server syncs.
That changes the definition in a rather non-obvious way, meaning this commit changes behaviour and refactors at the same time. That should be split, and this should be justified. It looks to me like it's going to cause a lot more spurious "hung" treatment.
I don't see how this changes the definition? The `waiting` flag indicates whether a thread is currently waiting or not on its queue, this is the same as checking the wait queues for an entry that waits on the queue?