source: lib/libtrace_message_queue.h @ 29bbef0

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

My work from over summer, with a few things tidied up and updated to include recent commits/patches to bring this up to date. Still very much work in progress.

  • Property mode set to 100644
File size: 1.3 KB
Line 
1#include <pthread.h>
2#include <assert.h>
3#include <limits.h>
4
5#ifndef LIBTRACE_MESSAGE_QUEUE
6#define LIBTRACE_MESSAGE_QUEUE
7
8#define LIBTRACE_MQ_FAILED INT_MIN
9typedef struct libtrace_thread_t libtrace_thread_t;
10typedef struct libtrace_message_queue_t {
11                int pipefd[2];
12                volatile int message_count;
13                size_t message_len;
14                pthread_spinlock_t spin;
15} libtrace_message_queue_t;
16
17typedef struct libtrace_message_t {
18        int code;
19        void *additional;
20        libtrace_thread_t *sender;
21} libtrace_message_t;
22
23inline void libtrace_message_queue_init(libtrace_message_queue_t *mq, size_t message_len);
24inline int libtrace_message_queue_put(libtrace_message_queue_t *mq, const void *message);
25inline int libtrace_message_queue_count(const libtrace_message_queue_t *mq);
26inline int libtrace_message_queue_get(libtrace_message_queue_t *mq, void *message);
27inline int libtrace_message_queue_try_get(libtrace_message_queue_t *mq, void *message);
28inline void libtrace_message_queue_destroy(libtrace_message_queue_t *mq);
29inline int libtrace_message_queue_get_fd(libtrace_message_queue_t *mq);
30
31enum libtrace_messages {
32        MESSAGE_STARTED,
33        MESSAGE_PAUSE,
34        MESSAGE_STOP,
35        MESSAGE_STOPPED,
36        MESSAGE_FIRST_PACKET,
37        MESSAGE_MAPPER_ENDED,
38        MESSAGE_MAPPER_RESUMED,
39        MESSAGE_MAPPER_PAUSED,
40        MESSAGE_MAPPER_EOF,
41        MESSAGE_POST_REDUCE,
42        MESSAGE_POST_RANGE,
43        MESSAGE_USER
44};
45#endif
Note: See TracBrowser for help on using the repository browser.