[vlc-devel] [PATCH 2/2] win32: do not (re)initialise config lock
remi at remlab.net
remi at remlab.net
Tue Dec 22 20:21:32 UTC 2020
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.
---
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
More information about the vlc-devel
mailing list