31 lines
683 B
C
31 lines
683 B
C
#ifndef PTHREAD_THREADS_ADAPTER_H
|
|
#define PTHREAD_THREADS_ADAPTER_H
|
|
|
|
#include <pthread.h>
|
|
|
|
typedef pthread_t thrd_t;
|
|
|
|
typedef int (*thrd_start_t)(void *);
|
|
|
|
void thrd_create(thrd_t *t, thrd_start_t func, void *arg);
|
|
void thrd_join(thrd_t t, int *res);
|
|
|
|
typedef pthread_mutex_t mtx_t;
|
|
|
|
enum { mtx_plain };
|
|
|
|
void mtx_init(mtx_t *m, int type);
|
|
#define mtx_destroy pthread_mutex_destroy
|
|
#define mtx_lock pthread_mutex_lock
|
|
#define mtx_unlock pthread_mutex_unlock
|
|
|
|
typedef pthread_cond_t cnd_t;
|
|
|
|
void cnd_init(cnd_t *c);
|
|
#define cnd_destroy pthread_cond_destroy
|
|
#define cnd_wait pthread_cond_wait
|
|
#define cnd_signal pthread_cond_signal
|
|
#define cnd_broadcast pthread_cond_broadcast
|
|
|
|
#endif
|