[PATCH 2/2] dsound: Wait on thread handle instead of dedicated event in DirectSoundDevice_Release.

Andrew Eikum aeikum at codeweavers.com
Mon Nov 26 08:49:11 CST 2018


Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>

On Thu, Nov 22, 2018 at 08:24:08PM +0100, Jacek Caban wrote:
> Signed-off-by: Jacek Caban <jacek at codeweavers.com>
> ---
>  dlls/dsound/dsound.c         | 4 +---
>  dlls/dsound/dsound_private.h | 1 -
>  dlls/dsound/mixer.c          | 1 -
>  3 files changed, 1 insertion(+), 5 deletions(-)
> 
> 

> diff --git a/dlls/dsound/dsound.c b/dlls/dsound/dsound.c
> index 12f1e286b3..71ede7d870 100644
> --- a/dlls/dsound/dsound.c
> +++ b/dlls/dsound/dsound.c
> @@ -203,9 +203,8 @@ static ULONG DirectSoundDevice_Release(DirectSoundDevice * device)
>  
>          SetEvent(device->sleepev);
>          if (device->thread) {
> -            WaitForSingleObject(device->thread_finished, INFINITE);
> +            WaitForSingleObject(device->thread, INFINITE);
>              CloseHandle(device->thread);
> -            CloseHandle(device->thread_finished);
>          }
>  
>          EnterCriticalSection(&DSOUND_renderers_lock);
> @@ -383,7 +382,6 @@ static HRESULT DirectSoundDevice_Initialize(DirectSoundDevice ** ppDevice, LPCGU
>  
>      ZeroMemory(&device->volpan, sizeof(device->volpan));
>  
> -    device->thread_finished = CreateEventW(0, 0, 0, 0);
>      device->thread = CreateThread(0, 0, DSOUND_mixthread, device, 0, 0);
>      SetThreadPriority(device->thread, THREAD_PRIORITY_TIME_CRITICAL);
>  
> diff --git a/dlls/dsound/dsound_private.h b/dlls/dsound/dsound_private.h
> index c045b38f4a..45a100eee7 100644
> --- a/dlls/dsound/dsound_private.h
> +++ b/dlls/dsound/dsound_private.h
> @@ -106,7 +106,6 @@ struct DirectSoundDevice
>      IAudioRenderClient *render;
>  
>      HANDLE sleepev, thread;
> -    HANDLE thread_finished;
>      struct list entry;
>  };
>  
> diff --git a/dlls/dsound/mixer.c b/dlls/dsound/mixer.c
> index 9b3e730961..32bde3800e 100644
> --- a/dlls/dsound/mixer.c
> +++ b/dlls/dsound/mixer.c
> @@ -765,6 +765,5 @@ DWORD CALLBACK DSOUND_mixthread(void *p)
>  		DSOUND_PerformMix(dev);
>  		RtlReleaseResource(&(dev->buffer_list_lock));
>  	}
> -	SetEvent(dev->thread_finished);
>  	return 0;
>  }
> 

> 




More information about the wine-devel mailing list