diff options
Diffstat (limited to 'toxcore/util.h')
-rw-r--r-- | toxcore/util.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/toxcore/util.h b/toxcore/util.h index fde9f03c..7670a80f 100644 --- a/toxcore/util.h +++ b/toxcore/util.h | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <pthread.h> | 30 | #include <pthread.h> |
31 | 31 | ||
32 | #define MIN(a,b) (((a)<(b))?(a):(b)) | 32 | #define MIN(a,b) (((a)<(b))?(a):(b)) |
33 | #define PAIR(TYPE1__, TYPE2__) struct { TYPE1__ first; TYPE2__ second; } | ||
33 | 34 | ||
34 | void unix_time_update(); | 35 | void unix_time_update(); |
35 | uint64_t unix_time(); | 36 | uint64_t unix_time(); |
@@ -54,6 +55,16 @@ typedef int (*load_state_callback_func)(void *outer, const uint8_t *data, uint32 | |||
54 | int load_state(load_state_callback_func load_state_callback, void *outer, | 55 | int load_state(load_state_callback_func load_state_callback, void *outer, |
55 | const uint8_t *data, uint32_t length, uint16_t cookie_inner); | 56 | const uint8_t *data, uint32_t length, uint16_t cookie_inner); |
56 | 57 | ||
58 | /* Returns -1 if failed or 0 if success */ | ||
57 | int create_recursive_mutex(pthread_mutex_t *mutex); | 59 | int create_recursive_mutex(pthread_mutex_t *mutex); |
58 | 60 | ||
61 | /* Ring buffer */ | ||
62 | typedef struct RingBuffer RingBuffer; | ||
63 | bool rb_full(const RingBuffer *b); | ||
64 | bool rb_empty(const RingBuffer *b); | ||
65 | void* rb_write(RingBuffer* b, void* p); | ||
66 | bool rb_read(RingBuffer* b, void** p); | ||
67 | void rb_clear(RingBuffer *b); | ||
68 | RingBuffer *rb_new(int size); | ||
69 | void rb_free(RingBuffer *b); | ||
59 | #endif /* __UTIL_H__ */ | 70 | #endif /* __UTIL_H__ */ |