source: lib/data-struct/deque.h @ ead9478

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivelibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since ead9478 was ead9478, checked in by Richard Sanger <rsangerarj@…>, 7 years ago

Use size_t rather than int for the data structures. Export vector, deque and ring_buffer for testing and use in programs.
Remove some inlines for now since these result in lots of compile warnings when also exported, the compiler is probably smart enough anyway.

  • Property mode set to 100644
File size: 921 bytes
Line 
1#include <pthread.h>
2#include "../libtrace.h"
3
4#ifndef LIBTRACE_DEQUE_H
5#define LIBTRACE_DEQUE_H
6
7typedef struct list_node list_node_t;
8typedef struct libtrace_queue {
9        list_node_t * head;
10        list_node_t * tail;
11        pthread_mutex_t lock;
12        size_t size;
13        size_t element_size;
14} libtrace_queue_t;
15
16DLLEXPORT void libtrace_deque_init(libtrace_queue_t * q, size_t element_size);
17DLLEXPORT void libtrace_deque_push_back(libtrace_queue_t *q, void *d);
18DLLEXPORT void libtrace_deque_push_front(libtrace_queue_t *q, void *d);
19DLLEXPORT size_t libtrace_deque_get_size(libtrace_queue_t *q);
20
21DLLEXPORT int libtrace_deque_peek_front(libtrace_queue_t *q, void *d);
22DLLEXPORT int libtrace_deque_peek_tail(libtrace_queue_t *q, void *d);
23DLLEXPORT int libtrace_deque_pop_front(libtrace_queue_t *q, void *d);
24DLLEXPORT int libtrace_deque_pop_tail(libtrace_queue_t *q, void *d);
25DLLEXPORT void libtrace_zero_deque(libtrace_queue_t *q);
26
27#endif
Note: See TracBrowser for help on using the repository browser.