#pragma once #include #include #include #include #define rb_init(size, type)\ {(size),\ 0, 0, false, false,\ type,\ malloc(sizeof(int)*(size)),\ PTHREAD_MUTEX_INITIALIZER}; #define rb_free(rb) free(rb.data) typedef struct rb{ size_t size; size_t w_pos, r_pos; bool filled; bool error; enum {DROP, WAIT} type; int* data; pthread_mutex_t m; } rb_t; void rb_push(rb_t*, int); int rb_pop(rb_t*);