Commit f31b4f46 authored by Thomas Jansen's avatar Thomas Jansen

Remove xpthread_* wrappers

parent 1914e114
...@@ -26,8 +26,11 @@ ...@@ -26,8 +26,11 @@
void cond_init(struct condition *cond) void cond_init(struct condition *cond)
{ {
xpthread_mutex_init(&cond->mutex, NULL); int err;
xpthread_cond_init(&cond->cond, NULL); 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) void cond_enter(struct condition *cond)
...@@ -82,6 +85,9 @@ void cond_signal_sync(struct condition *cond) ...@@ -82,6 +85,9 @@ void cond_signal_sync(struct condition *cond)
void cond_destroy(struct condition *cond) void cond_destroy(struct condition *cond)
{ {
xpthread_cond_destroy(&cond->cond); int err;
xpthread_mutex_destroy(&cond->mutex); 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));
} }
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include "utils.h" #include "utils.h"
#include <assert.h> #include <assert.h>
#include <pthread.h>
#include <string.h> #include <string.h>
static pthread_mutex_t nr_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t nr_lock = PTHREAD_MUTEX_INITIALIZER;
......
...@@ -196,34 +196,6 @@ void init_async_pipe(int file_des[2]) ...@@ -196,34 +196,6 @@ void init_async_pipe(int file_des[2])
FATAL("Couldn't set non-blocking I/O: %s\n", strerror(errno)); 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) int stringFoundInStringArray(const char *const*array, const char *suffix)
{ {
while (array && *array) { while (array && *array) {
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#include <pthread.h>
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
...@@ -98,14 +97,6 @@ int set_nonblocking(int fd); ...@@ -98,14 +97,6 @@ int set_nonblocking(int fd);
void init_async_pipe(int file_des[2]); 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); int stringFoundInStringArray(const char *const*array, const char *suffix);
#endif #endif
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