use nix build & meson & zlog
This commit is contained in:
parent
0123623742
commit
346768a144
60 changed files with 13739 additions and 0 deletions
38
src/include/mylock.h
Normal file
38
src/include/mylock.h
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#if !defined(_MYLOCK_H_)
|
||||
|
||||
#define _MYLOCK_H_ 1
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
typedef pthread_mutex_t mylock_t;
|
||||
typedef pthread_rwlock_t my_rwlock_t;
|
||||
|
||||
typedef struct {
|
||||
int ncap;
|
||||
int head;
|
||||
int len;
|
||||
int isize;
|
||||
void* data;
|
||||
pthread_mutex_t mutex;
|
||||
pthread_cond_t condget;
|
||||
pthread_cond_t condput;
|
||||
} cbuf_t;
|
||||
|
||||
extern int mylock_init(mylock_t*);
|
||||
extern void mylock_fini(mylock_t*);
|
||||
extern int mylock_try(mylock_t*);
|
||||
extern int mylock_lock(mylock_t*);
|
||||
extern int mylock_unlock(mylock_t*);
|
||||
|
||||
extern int my_rwlock_init(my_rwlock_t*);
|
||||
extern void my_rwlock_fini(my_rwlock_t*);
|
||||
extern int my_rwlock_rlock(my_rwlock_t*);
|
||||
extern int my_rwlock_wlock(my_rwlock_t*);
|
||||
extern int my_rwlock_unlock(my_rwlock_t*);
|
||||
|
||||
extern int cbuf_init(cbuf_t*, int, int);
|
||||
extern void cbuf_fini(cbuf_t*);
|
||||
extern int cbuf_put(cbuf_t*, void*);
|
||||
extern int cbuf_tryput(cbuf_t*, void*);
|
||||
extern int cbuf_get(cbuf_t*, void*);
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue