Make create_ckmsgq return a pointer to the generated queue and export the ckdbq functions

This commit is contained in:
ckolivas 2014-06-19 14:31:28 +10:00
parent 50463445c0
commit 997a88191c
2 changed files with 6 additions and 2 deletions

View File

@ -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

View File

@ -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)