From b40069616c162d80300e4477217d498d104f0307 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Fri, 28 Dec 2018 14:08:16 +0100 Subject: [PATCH] module/mpd: refresh_abort_fd now uses -1 to indicate there are is no active thread --- modules/mpd/mpd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/mpd/mpd.c b/modules/mpd/mpd.c index 134bc0e..6ef356c 100644 --- a/modules/mpd/mpd.c +++ b/modules/mpd/mpd.c @@ -50,7 +50,7 @@ static void destroy(struct module *mod) { struct private *m = mod->private; - if (m->refresh_abort_fd != 0) + if (m->refresh_abort_fd != -1) write(m->refresh_abort_fd, &(uint64_t){1}, sizeof(uint64_t)); free(m->host); @@ -373,12 +373,12 @@ refresh_in(struct module *mod, long milli_seconds) /* Abort currently running refresh thread */ mtx_lock(&mod->lock); - if (m->refresh_abort_fd != 0) { + if (m->refresh_abort_fd != -1) { LOG_DBG("aborting current refresh thread"); write(m->refresh_abort_fd, &(uint64_t){1}, sizeof(uint64_t)); /* Closed by thread */ - m->refresh_abort_fd = 0; + m->refresh_abort_fd = -1; } mtx_unlock(&mod->lock); @@ -421,7 +421,7 @@ module_mpd(const char *host, uint16_t port, struct particle *label) priv->elapsed.value = 0; priv->elapsed.when.tv_sec = priv->elapsed.when.tv_nsec = 0; priv->duration = 0; - priv->refresh_abort_fd = 0; + priv->refresh_abort_fd = -1; struct module *mod = module_common_new(); mod->private = priv;