From a44d00bf43ae2a4d7b661bd7f3c422a1bbdc0fdd Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sat, 24 Jan 2015 13:07:50 +1100 Subject: [PATCH] Maintain a count of messages used in ckmsgq --- src/ckpool.c | 1 + src/ckpool.h | 1 + 2 files changed, 2 insertions(+) diff --git a/src/ckpool.c b/src/ckpool.c index bac50095..82623475 100644 --- a/src/ckpool.c +++ b/src/ckpool.c @@ -183,6 +183,7 @@ void ckmsgq_add(ckmsgq_t *ckmsgq, void *data) msg->data = data; mutex_lock(ckmsgq->lock); + ckmsgq->messages++; DL_APPEND(ckmsgq->msgs, msg); pthread_cond_signal(ckmsgq->cond); mutex_unlock(ckmsgq->lock); diff --git a/src/ckpool.h b/src/ckpool.h index 83424fc5..27116b5c 100644 --- a/src/ckpool.h +++ b/src/ckpool.h @@ -38,6 +38,7 @@ struct ckmsgq { pthread_cond_t *cond; ckmsg_t *msgs; void (*func)(ckpool_t *, void *); + int64_t messages; }; typedef struct ckmsgq ckmsgq_t;