Commit ee1d723a authored by Max Kellermann's avatar Max Kellermann

notify: make notify_init() failures fatal

When a mutex cannot be created, there must be something very wrong. Induce panic and abort MPD in this case.
parent 770b1405
......@@ -17,24 +17,21 @@
*/
#include "notify.h"
#include "log.h"
int notify_init(struct notify *notify)
void notify_init(struct notify *notify)
{
int ret;
ret = pthread_mutex_init(&notify->mutex, NULL);
if (ret != 0)
return ret;
FATAL("pthread_mutex_init() failed");
ret = pthread_cond_init(&notify->cond, NULL);
if (ret != 0) {
pthread_mutex_destroy(&notify->mutex);
return ret;
}
if (ret != 0)
FATAL("pthread_mutex_init() failed");
notify->pending = 0;
return 0;
}
void notify_enter(struct notify *notify)
......
......@@ -27,7 +27,7 @@ typedef struct notify {
int pending;
} Notify;
int notify_init(struct notify *notify);
void notify_init(struct notify *notify);
/**
* The thread which shall be notified by this object must call this
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment