mmdevapi: Avoid lock contention after SetEvent.

Joerg-Cyril.Hoehle at t-systems.com Joerg-Cyril.Hoehle at t-systems.com
Thu Dec 20 07:03:06 CST 2012


Hi,

what's up with this patch?

I wrote:
>SetEvent is one of those calls with a high probability that the
>Linux scheduler will switch to another thread, e.g. the one receiving
>the event.  As the critical section is still hold, it'll prevent the
>receiver from invoking mmdevapi, e.g. GetCurrentPadding, without two
>more thread switches (forth and back).  We don't need that.

Now that This->event is constant between IAC_Start and IAC_Release,
thanks to my "SetEventHandle is allowed once only" patch,
it's safe to move SetEvent(This->event) outside of the CS.

Unlike the rejected patch about a CreateTimerQueue race condition
internal to Wine (and only relevant in lock-less mode),
this one is between the driver and the client app that blocks when calling e.g.
GetCurrentPadding, what almost all apps will do, including our DSound
http://source.winehq.org/source/dlls/dsound/mixer.c#L679

Regards,
        Jörg Höhle


More information about the wine-devel mailing list