[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    [PATCH 4/4] strmbase: Swap the lock order in IPin::EndFlush().
From:       Zebediah Figura <z.figura12 () gmail ! com>
Date:       2019-11-28 23:35:41
Message-ID: 20191128233541.432357-4-z.figura12 () gmail ! com
[Download RAW message or body]

This more closely resembles the threading model prescribed by the DirectX SDK
documentation. In particular, the page "Flushing Data" recommends that
IPin::BeginFlush() do the following steps in order:

1. take the filter lock
2. signal the streaming thread to complete
3. take the streaming lock, if necessary

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
---
 dlls/strmbase/renderer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/strmbase/renderer.c b/dlls/strmbase/renderer.c
index 0ef9c5b225..cacbb90e59 100644
--- a/dlls/strmbase/renderer.c
+++ b/dlls/strmbase/renderer.c
@@ -133,8 +133,8 @@ static HRESULT WINAPI BaseRenderer_InputPin_EndFlush(IPin * iface)
 
     TRACE("iface %p.\n", iface);
 
-    EnterCriticalSection(&pFilter->csRenderLock);
     EnterCriticalSection(&pFilter->filter.csFilter);
+    EnterCriticalSection(&pFilter->csRenderLock);
     pFilter->eos = FALSE;
     hr = BaseInputPinImpl_EndFlush(iface);
     if (SUCCEEDED(hr))
@@ -146,8 +146,8 @@ static HRESULT WINAPI BaseRenderer_InputPin_EndFlush(IPin * iface)
         if (pFilter->pFuncsTable->pfnEndFlush)
             hr = pFilter->pFuncsTable->pfnEndFlush(pFilter);
     }
-    LeaveCriticalSection(&pFilter->filter.csFilter);
     LeaveCriticalSection(&pFilter->csRenderLock);
+    LeaveCriticalSection(&pFilter->filter.csFilter);
     return hr;
 }
 
-- 
2.24.0


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic