From 5ec8191dedf736d50d747cc48630d697fe07f3f9 Mon Sep 17 00:00:00 2001 From: Samy Al Bahra Date: Sat, 1 Mar 2014 15:47:16 -0500 Subject: [PATCH] ck_fifo: Add ck_fifo_*_deinit routines. These allow for reclamation of garbage node in an empty FIFO. Based on patch submitted by Rajesh R . --- include/ck_fifo.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/ck_fifo.h b/include/ck_fifo.h index cf2abc7..5d18738 100644 --- a/include/ck_fifo.h +++ b/include/ck_fifo.h @@ -111,6 +111,15 @@ ck_fifo_spsc_init(struct ck_fifo_spsc *fifo, struct ck_fifo_spsc_entry *stub) return; } +CK_CC_INLINE static void +ck_fifo_spsc_deinit(struct ck_fifo_spsc *fifo, struct ck_fifo_spsc_entry **garbage) +{ + + *garbage = fifo->garbage; + fifo->head = fifo->tail = NULL; + return; +} + CK_CC_INLINE static void ck_fifo_spsc_enqueue(struct ck_fifo_spsc *fifo, struct ck_fifo_spsc_entry *entry, @@ -223,6 +232,15 @@ ck_fifo_mpmc_init(struct ck_fifo_mpmc *fifo, struct ck_fifo_mpmc_entry *stub) return; } +CK_CC_INLINE static void +ck_fifo_mpmc_deinit(struct ck_fifo_mpmc *fifo, struct ck_fifo_mpmc_entry **garbage) +{ + + *garbage = fifo->head.pointer; + fifo->head.pointer = fifo->tail.pointer = NULL; + return; +} + CK_CC_INLINE static void ck_fifo_mpmc_enqueue(struct ck_fifo_mpmc *fifo, struct ck_fifo_mpmc_entry *entry,