20 #ifndef included_svm_queue_h 21 #define included_svm_queue_h 25 typedef struct _svm_queue
27 pthread_mutex_t mutex;
28 pthread_cond_t condvar;
void svm_queue_unlock(svm_queue_t *q)
void svm_queue_lock(svm_queue_t *q)
int svm_queue_add_nolock(svm_queue_t *q, u8 *elem)
void svm_queue_set_consumer_event_fd(svm_queue_t *q, int fd)
Set consumer's event fd.
int svm_queue_sub_raw(svm_queue_t *q, u8 *elem)
void svm_queue_wait(svm_queue_t *q)
Wait for queue event.
void svm_queue_add_raw(svm_queue_t *q, u8 *elem)
Add element to queue with mutex held.
blocking call, returns on signal or time-out - best used in combination with condvars, with eventfds we don't yield the cpu
svm_queue_t unix_shared_memory_queue_t
int svm_queue_sub2(svm_queue_t *q, u8 *elem)
svm_queue_t * svm_queue_init(void *base, int nels, int elsize)
void svm_queue_free(svm_queue_t *q)
int svm_queue_is_full(svm_queue_t *q)
int svm_queue_add(svm_queue_t *q, u8 *elem, int nowait)
int svm_queue_timedwait(svm_queue_t *q, double timeout)
Timed wait for queue event.
void svm_queue_send_signal(svm_queue_t *q, u8 is_prod)
int svm_queue_add2(svm_queue_t *q, u8 *elem, u8 *elem2, int nowait)
blocking call - best used in combination with condvars, for eventfds we don't yield the cpu ...
struct _svm_queue svm_queue_t
int svm_queue_sub(svm_queue_t *q, u8 *elem, svm_q_conditional_wait_t cond, u32 time)
void svm_queue_set_producer_event_fd(svm_queue_t *q, int fd)
Set producer's event fd.
svm_queue_t * svm_queue_alloc_and_init(int nels, int elsize, int consumer_pid)
Allocate and initialize svm queue.
non-blocking call - works with both condvar and eventfd signaling