Remove xpthread_* wrappers
This commit is contained in:
parent
1914e11466
commit
f31b4f46e1
@ -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));
|
||||
}
|
||||
|
@ -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;
|
||||
|
28
src/utils.c
28
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) {
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user