mirror of
https://github.com/owntone/owntone-server.git
synced 2025-11-26 04:26:14 -05:00
[threads] Added missing initializers, check errors on mutex/cond calls
This commit is contained in:
23
src/main.c
23
src/main.c
@@ -44,8 +44,6 @@
|
||||
# include <sys/event.h>
|
||||
#endif
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#include <getopt.h>
|
||||
#include <event2/event.h>
|
||||
#include <libavutil/log.h>
|
||||
@@ -422,26 +420,29 @@ signal_kqueue_cb(int fd, short event, void *arg)
|
||||
|
||||
|
||||
static int
|
||||
ffmpeg_lockmgr(void **mutex, enum AVLockOp op)
|
||||
ffmpeg_lockmgr(void **pmutex, enum AVLockOp op)
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
case AV_LOCK_CREATE:
|
||||
*mutex = malloc(sizeof(pthread_mutex_t));
|
||||
if (!*mutex)
|
||||
*pmutex = malloc(sizeof(pthread_mutex_t));
|
||||
if (!*pmutex)
|
||||
return 1;
|
||||
|
||||
return !!pthread_mutex_init(*mutex, NULL);
|
||||
fork_mutex_init(*pmutex);
|
||||
return 0;
|
||||
|
||||
case AV_LOCK_OBTAIN:
|
||||
return !!pthread_mutex_lock(*mutex);
|
||||
fork_mutex_lock(*pmutex);
|
||||
return 0;
|
||||
|
||||
case AV_LOCK_RELEASE:
|
||||
return !!pthread_mutex_unlock(*mutex);
|
||||
fork_mutex_unlock(*pmutex);
|
||||
return 0;
|
||||
|
||||
case AV_LOCK_DESTROY:
|
||||
pthread_mutex_destroy(*mutex);
|
||||
free(*mutex);
|
||||
fork_mutex_destroy(*pmutex);
|
||||
free(*pmutex);
|
||||
*pmutex = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user