summaryrefslogtreecommitdiff
path: root/code/core/msgq.h
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2017-08-16 21:21:33 +0200
committerUros Majstorovic <majstor@majstor.org>2017-08-16 21:21:33 +0200
commit8f44e2151cb3f91b220c4a3393a06068d0ee7302 (patch)
tree8320c304887ac9b0d922bc27b51330c084f34ee0 /code/core/msgq.h
parent38e2385f5846860916f8880d818b3b024b8c7dd9 (diff)
fixed rbuf; fixed error code for pthread_mitex_init
Diffstat (limited to 'code/core/msgq.h')
-rw-r--r--code/core/msgq.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/code/core/msgq.h b/code/core/msgq.h
index 54319e0..75c795e 100644
--- a/code/core/msgq.h
+++ b/code/core/msgq.h
@@ -1,23 +1,26 @@
-#ifdef ECP_WITH_PTHREAD
+#ifdef ECP_WITH_MSGQ
#include <pthread.h>
#include <string.h>
-#define ECP_MAX_CONN_MSG 32
-#define ECP_ERR_MAX_CONN_MSG -100
+#define ECP_MSGQ_MAX_MSG 32
+#define ECP_MSGQ_ERR_MAX_MSG -110
typedef struct ECPConnMsgQ {
unsigned short idx_w[ECP_MAX_MTYPE];
unsigned short idx_r[ECP_MAX_MTYPE];
- ecp_seq_t seq_msg[ECP_MAX_MTYPE][ECP_MAX_CONN_MSG];
+ ecp_seq_t seq_start;
+ ecp_seq_t seq_max;
+ ecp_seq_t seq_msg[ECP_MAX_MTYPE][ECP_MSGQ_MAX_MSG];
pthread_cond_t cond[ECP_MAX_MTYPE];
pthread_mutex_t mutex;
} ECPConnMsgQ;
int ecp_conn_msgq_create(struct ECPConnection *conn);
void ecp_conn_msgq_destroy(struct ECPConnection *conn);
+int ecp_conn_msgq_start(struct ECPConnection *conn, ecp_seq_t seq);
int ecp_conn_msgq_push(struct ECPConnection *conn, ecp_seq_t seq, unsigned char mtype);
ssize_t ecp_conn_msgq_pop(struct ECPConnection *conn, unsigned char mtype, unsigned char *msg, size_t msg_size, unsigned int timeout);
-#endif /* ECP_WITH_PTHREAD */ \ No newline at end of file
+#endif /* ECP_WITH_MSGQ */ \ No newline at end of file