Add encoder for monitoring responses
[trust_router.git] / include / tr_mq.h
index 81cb325..f60c7af 100644 (file)
@@ -37,6 +37,7 @@
 
 #include <talloc.h>
 #include <pthread.h>
+#include <time.h>
 
 /* Note on mq priorities: High priority messages are guaranteed to be
  * processed before any normal priority messages. Otherwise, messages
@@ -63,6 +64,7 @@ typedef struct tr_mq TR_MQ;
 typedef void (*TR_MQ_NOTIFY_FN)(TR_MQ *, void *);
 struct tr_mq {
   pthread_mutex_t mutex;
+  pthread_cond_t have_msg_cond;
   TR_MQ_MSG *head;
   TR_MQ_MSG *tail;
   TR_MQ_MSG *last_hi_prio;
@@ -87,7 +89,8 @@ int tr_mq_lock(TR_MQ *mq);
 int tr_mq_unlock(TR_MQ *mq);
 void tr_mq_set_notify_cb(TR_MQ *mq, TR_MQ_NOTIFY_FN cb, void *arg);
 void tr_mq_add(TR_MQ *mq, TR_MQ_MSG *msg);
-TR_MQ_MSG *tr_mq_pop(TR_MQ *mq);
+int tr_mq_pop_timeout(time_t seconds, struct timespec *ts);
+TR_MQ_MSG *tr_mq_pop(TR_MQ *mq, struct timespec *ts_abort);
 void tr_mq_clear(TR_MQ *mq);
  
 #endif /*_TR_MQ_H_ */