diff --git a/src/LinkedBlockingQueue.c b/src/LinkedBlockingQueue.c index 35fb5fe..464a94b 100644 --- a/src/LinkedBlockingQueue.c +++ b/src/LinkedBlockingQueue.c @@ -2,7 +2,7 @@ // Destroy the linked blocking queue and associated mutex and event PLINKED_BLOCKING_QUEUE_ENTRY LbqDestroyLinkedBlockingQueue(PLINKED_BLOCKING_QUEUE queueHead) { - LC_ASSERT(queueHead->shutdown); + LC_ASSERT(queueHead->shutdown || queueHead->lifetimeSize == 0); PltDeleteMutex(&queueHead->mutex); PltCloseEvent(&queueHead->containsDataEvent); @@ -87,6 +87,7 @@ int LbqOfferQueueItem(PLINKED_BLOCKING_QUEUE queueHead, void* data, PLINKED_BLOC } queueHead->currentSize++; + queueHead->lifetimeSize++; PltUnlockMutex(&queueHead->mutex); diff --git a/src/LinkedBlockingQueue.h b/src/LinkedBlockingQueue.h index df74067..ad861fc 100644 --- a/src/LinkedBlockingQueue.h +++ b/src/LinkedBlockingQueue.h @@ -20,6 +20,7 @@ typedef struct _LINKED_BLOCKING_QUEUE { int sizeBound; int currentSize; int shutdown; + int lifetimeSize; PLINKED_BLOCKING_QUEUE_ENTRY head; PLINKED_BLOCKING_QUEUE_ENTRY tail; } LINKED_BLOCKING_QUEUE, *PLINKED_BLOCKING_QUEUE;