aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/condition.c14
-rw-r--r--src/songvec.c1
-rw-r--r--src/utils.c28
-rw-r--r--src/utils.h9
4 files changed, 11 insertions, 41 deletions
diff --git a/src/condition.c b/src/condition.c
index c1fe8ed18..b23bed51e 100644
--- a/src/condition.c
+++ b/src/condition.c
@@ -26,8 +26,11 @@
void cond_init(struct condition *cond)
{
- xpthread_mutex_init(&cond->mutex, NULL);
- xpthread_cond_init(&cond->cond, NULL);
+ int err;
+ if ((err = pthread_mutex_init(&cond->mutex, NULL)))
+ FATAL("failed to init mutex: %s\n", strerror(err));
+ if ((err = pthread_cond_init(&cond->cond, NULL)))
+ FATAL("failed to init cond: %s\n", strerror(err));
}
void cond_enter(struct condition *cond)
@@ -82,6 +85,9 @@ void cond_signal_sync(struct condition *cond)
void cond_destroy(struct condition *cond)
{
- xpthread_cond_destroy(&cond->cond);
- xpthread_mutex_destroy(&cond->mutex);
+ int err;
+ if ((err = pthread_cond_destroy(&cond->cond)))
+ FATAL("failed to destroy cond: %s\n", strerror(err));
+ if ((err = pthread_mutex_destroy(&cond->mutex)))
+ FATAL("failed to destroy mutex: %s\n", strerror(err));
}
diff --git a/src/songvec.c b/src/songvec.c
index df600f92a..64db4cd4c 100644
--- a/src/songvec.c
+++ b/src/songvec.c
@@ -3,6 +3,7 @@
#include "utils.h"
#include <assert.h>
+#include <pthread.h>
#include <string.h>
static pthread_mutex_t nr_lock = PTHREAD_MUTEX_INITIALIZER;
diff --git a/src/utils.c b/src/utils.c
index 9d763c484..372414ab8 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -196,34 +196,6 @@ void init_async_pipe(int file_des[2])
FATAL("Couldn't set non-blocking I/O: %s\n", strerror(errno));
}
-void xpthread_mutex_init(pthread_mutex_t *m, const pthread_mutexattr_t *a)
-{
- int err;
- if ((err = pthread_mutex_init(m, a)))
- FATAL("failed to init mutex: %s\n", strerror(err));
-}
-
-void xpthread_cond_init(pthread_cond_t *c, pthread_condattr_t *a)
-{
- int err;
- if ((err = pthread_cond_init(c, a)))
- FATAL("failed to init cond: %s\n", strerror(err));
-}
-
-void xpthread_mutex_destroy(pthread_mutex_t *mutex)
-{
- int err;
- if ((err = pthread_mutex_destroy(mutex)))
- FATAL("failed to destroy mutex: %s\n", strerror(err));
-}
-
-void xpthread_cond_destroy(pthread_cond_t *cond)
-{
- int err;
- if ((err = pthread_cond_destroy(cond)))
- FATAL("failed to destroy cond: %s\n", strerror(err));
-}
-
int stringFoundInStringArray(const char *const*array, const char *suffix)
{
while (array && *array) {
diff --git a/src/utils.h b/src/utils.h
index 9701b9d4c..2142df7f4 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -24,7 +24,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
-#include <pthread.h>
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
@@ -98,14 +97,6 @@ int set_nonblocking(int fd);
void init_async_pipe(int file_des[2]);
-void xpthread_mutex_init(pthread_mutex_t *m, const pthread_mutexattr_t *a);
-
-void xpthread_cond_init(pthread_cond_t *c, pthread_condattr_t *a);
-
-void xpthread_mutex_destroy(pthread_mutex_t *mutex);
-
-void xpthread_cond_destroy(pthread_cond_t *cond);
-
int stringFoundInStringArray(const char *const*array, const char *suffix);
#endif