threads: unbreak mpv on builds without asserts

Also remove duplicated macro.

Fixes: #12818 #12820
This commit is contained in:
Kacper Michajłow 2023-11-06 04:55:36 +01:00 committed by Dudemanguy
parent 84de84b8aa
commit a7186777de
3 changed files with 2 additions and 4 deletions

View File

@ -122,6 +122,7 @@ static inline int mp_mutex_init_type_internal(mp_mutex *mutex, enum mp_mutex_typ
pthread_mutexattr_settype(&attr, mutex_type); pthread_mutexattr_settype(&attr, mutex_type);
ret = pthread_mutex_init(mutex, &attr); ret = pthread_mutex_init(mutex, &attr);
pthread_mutexattr_destroy(&attr); pthread_mutexattr_destroy(&attr);
assert(!ret);
return ret; return ret;
} }

View File

@ -51,9 +51,6 @@ static inline int mp_mutex_init_type_internal(mp_mutex *mutex, enum mp_mutex_typ
return 0; return 0;
} }
#define mp_mutex_init_type(mutex, mtype) \
assert(!mp_mutex_init_type_internal(mutex, mtype))
static inline int mp_mutex_destroy(mp_mutex *mutex) static inline int mp_mutex_destroy(mp_mutex *mutex)
{ {
if (mutex->use_cs) if (mutex->use_cs)

View File

@ -12,7 +12,7 @@ enum mp_mutex_type {
mp_mutex_init_type(mutex, MP_MUTEX_NORMAL) mp_mutex_init_type(mutex, MP_MUTEX_NORMAL)
#define mp_mutex_init_type(mutex, mtype) \ #define mp_mutex_init_type(mutex, mtype) \
assert(!mp_mutex_init_type_internal(mutex, mtype)) mp_mutex_init_type_internal(mutex, mtype)
#if HAVE_WIN32_THREADS #if HAVE_WIN32_THREADS
#include "threads-win32.h" #include "threads-win32.h"