[vlc-devel] [PATCH 2/2] win32: do not (re)initialise config lock
Steve Lhomme
robux4 at ycbcr.xyz
Mon Jan 4 07:28:43 UTC 2021
On 2020-12-22 21:21, remi at remlab.net wrote:
> From: RĂ©mi Denis-Courmont <remi at remlab.net>
>
> This is a static lock. As of 4.0.0-dev-11158-ga18c4d6570, there are no
> needs to initialise static locks on Windows.
I could not find any commit with ga18c4d6570 in the SHA1. Anyway this
seems correct as config_lock is initialized with VLC_STATIC_RWLOCK which
has a proper value when LIBVLC_NEED_RWLOCK is set.
> ---
> src/os2/thread.c | 3 +++
> src/win32/thread.c | 4 ----
> 2 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/src/os2/thread.c b/src/os2/thread.c
> index 0d7bc9e79f..822b3f3b26 100644
> --- a/src/os2/thread.c
> +++ b/src/os2/thread.c
> @@ -131,6 +131,7 @@ static ULONG vlc_Sleep (ULONG ulTimeout)
>
> static vlc_mutex_t super_mutex;
> static vlc_cond_t super_variable;
> +extern vlc_rwlock_t config_lock;
>
> int _CRT_init(void);
> void _CRT_term(void);
> @@ -150,10 +151,12 @@ unsigned long _System _DLL_InitTerm(unsigned long hmod, unsigned long flag)
> vlc_mutex_init (&super_mutex);
> vlc_cond_init (&super_variable);
> vlc_threadvar_create (&thread_key, NULL);
> + vlc_rwlock_init (&config_lock);
>
> return 1;
>
> case 1 : /* Termination */
> + vlc_rwlock_destroy (&config_lock);
> vlc_threadvar_delete (&thread_key);
>
> _CRT_term();
> diff --git a/src/win32/thread.c b/src/win32/thread.c
> index 60b4232e04..91f3c40eaa 100644
> --- a/src/win32/thread.c
> +++ b/src/win32/thread.c
> @@ -785,8 +785,6 @@ void vlc_threads_setup(libvlc_int_t *vlc)
>
> #define LOOKUP(s) (((s##_) = (void *)GetProcAddress(h, #s)) != NULL)
>
> -extern vlc_rwlock_t config_lock;
> -
> BOOL WINAPI DllMain (HANDLE hinstDll, DWORD fdwReason, LPVOID lpvReserved)
> {
> (void) hinstDll;
> @@ -816,12 +814,10 @@ BOOL WINAPI DllMain (HANDLE hinstDll, DWORD fdwReason, LPVOID lpvReserved)
> InitializeCriticalSection(&setup_lock);
> InitializeCriticalSection(&super_mutex);
> InitializeConditionVariable(&super_variable);
> - vlc_rwlock_init (&config_lock);
> break;
> }
>
> case DLL_PROCESS_DETACH:
> - vlc_rwlock_destroy (&config_lock);
> DeleteCriticalSection(&super_mutex);
> DeleteCriticalSection(&setup_lock);
> TlsFree(thread_key);
> --
> 2.29.2
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
>
More information about the vlc-devel
mailing list