http://bugs.winehq.org/show_bug.cgi?id=29657
--- Comment #3 from Jörg Höhle hoehle@users.sourceforge.net 2012-01-29 14:15:07 CST --- Created attachment 38597 --> http://bugs.winehq.org/attachment.cgi?id=38597 lockless callback design for winecoreaudio
Here are the 3 parts. The wineoss part needs to be completed.
Obviously the code is begging for merging the third queue from get_current_aqbuffer_position, perhaps via resolution of bug #29602. There should be 2 queues only, and AQBuffer integrate sample time data.
Now you can run hundreds of test iterations without dead-lock and with little CPU usage.
I've had one test run where EnqueueBuffer failed in render.c. AudioRenderClient_ReleaseBuffer (0x149480)->(20671, 2) er::AudioRenderClient_ReleaseBuffer Unable to enqueue buffer: fffefb8e That was before I merged Andrew's GetPosition patch from bug #29602.
Also, WaitForSingleObject(event, 70) fails with rc=102 in rare cases. That means that there's either a flaw in the logic, or even on a dual core MacOS, the CreateTimerQueue events can be very far from 10ms apart... I can't remember whether that happened before I introduced EXECUTEINTIMERTHREAD though.