RFC: yield on Waits

Jeremy White jwhite at codeweavers.com
Mon Nov 1 15:11:10 CST 2004

Hi folks,

Due to my new found belief that all of the flaws in Wine
are timing problems, I have found what appears to be a
gaping hole in Wine's timing behavior.

Specifically, it appears as though any style of
Waitxxx is supposed to yield the processor.

This seems a bit difficult for me to believe,
even though we had earlier discovered that Wine was never
yielding on a Sleep(0).

I've attached the test program I used to discover
this.  If you run
   sleep2 -1 0w
the program will start 2 threads, one which spin loops
(-1), and one which does a wait on an object for 0
seconds.  You'll see in the results that the Wait(...,0)
thread gets far fewer loops, and thus must be yielding.

Further, changing that to a 0ws (or even 5ws), which
means we're waiting on a signalled object, doesn't
change the behavior.

This leads me to suggest the attached patch.

I would appreciate review from other folks, because this
seems like a drastic change to me, and it strikes
me as equally likely that I've done something stupid.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: sleep2.c
Type: text/x-csrc
Size: 3045 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20041101/1571e798/sleep2.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ntdll.sync.patch
Type: text/x-patch
Size: 614 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20041101/1571e798/ntdll.sync.bin

More information about the wine-devel mailing list