aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/utils.c14
-rw-r--r--src/utils.h4
2 files changed, 18 insertions, 0 deletions
diff --git a/src/utils.c b/src/utils.c
index eedae22de..332c73587 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -241,6 +241,20 @@ 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;
diff --git a/src/utils.h b/src/utils.h
index eb16e87bc..6a6e562cf 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -82,6 +82,10 @@ 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);