From 997a88191cd69396eb892f4a69c2b8642006f50b Mon Sep 17 00:00:00 2001 From: ckolivas Date: Thu, 19 Jun 2014 14:31:28 +1000 Subject: [PATCH] Make create_ckmsgq return a pointer to the generated queue and export the ckdbq functions --- src/libckpool.c | 6 ++++-- src/libckpool.h | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libckpool.c b/src/libckpool.c index 77f682b9..c7af5c13 100644 --- a/src/libckpool.c +++ b/src/libckpool.c @@ -77,7 +77,7 @@ void join_pthread(pthread_t thread) } /* Generic function for creating a message queue receiving and parsing thread */ -void *ckmsg_queue(void *arg) +static void *ckmsg_queue(void *arg) { ckmsgq_t *ckmsgq = (ckmsgq_t *)arg; @@ -103,7 +103,7 @@ void *ckmsg_queue(void *arg) return NULL; } -void create_ckmsgq(const char *name, const void *func) +ckmsgq_t *create_ckmsgq(const char *name, const void *func) { ckmsgq_t *ckmsgq = ckzalloc(sizeof(ckmsgq_t)); @@ -112,6 +112,8 @@ void create_ckmsgq(const char *name, const void *func) mutex_init(&ckmsgq->lock); cond_init(&ckmsgq->cond); create_pthread(&ckmsgq->pth, ckmsg_queue, ckmsgq); + + return ckmsgq; } /* Generic function for adding messages to a ckmsgq linked list and signal the ckmsgq diff --git a/src/libckpool.h b/src/libckpool.h index 5b709d23..6ce914d4 100644 --- a/src/libckpool.h +++ b/src/libckpool.h @@ -280,6 +280,8 @@ struct ckmsgq { }; typedef struct ckmsgq ckmsgq_t; +ckmsgq_t *create_ckmsgq(const char *name, const void *func); +void ckmsgq_add(ckmsgq_t *ckmsgq, void *data); /* No error checking with these, make sure we know they're valid already! */ static inline void json_strcpy(char *buf, json_t *val, const char *key)