source: lib/data-struct/message_queue.h @ fb1fd42

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

Move the data structures out of the way and into there own folder and tidy file naming.

  • Property mode set to 100644
File size: 1.0 KB
Line 
1#include <pthread.h>
2#include <limits.h>
3
4#ifndef LIBTRACE_MESSAGE_QUEUE
5#define LIBTRACE_MESSAGE_QUEUE
6
7#define LIBTRACE_MQ_FAILED INT_MIN
8typedef struct libtrace_thread_t libtrace_thread_t;
9typedef struct libtrace_message_queue_t {
10        int pipefd[2];
11        volatile int message_count;
12        size_t message_len;
13        pthread_spinlock_t spin;
14} libtrace_message_queue_t;
15
16typedef struct libtrace_message_t {
17        int code;
18        void *additional;
19        libtrace_thread_t *sender;
20} libtrace_message_t;
21
22inline void libtrace_message_queue_init(libtrace_message_queue_t *mq, size_t message_len);
23inline int libtrace_message_queue_put(libtrace_message_queue_t *mq, const void *message);
24inline int libtrace_message_queue_count(const libtrace_message_queue_t *mq);
25inline int libtrace_message_queue_get(libtrace_message_queue_t *mq, void *message);
26inline int libtrace_message_queue_try_get(libtrace_message_queue_t *mq, void *message);
27inline void libtrace_message_queue_destroy(libtrace_message_queue_t *mq);
28inline int libtrace_message_queue_get_fd(libtrace_message_queue_t *mq);
29
30#endif
Note: See TracBrowser for help on using the repository browser.