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 <rr01803@gm....>.
ck_pring
Samy Al Bahra 11 years ago
parent e0c65bd98b
commit 5ec8191ded

@ -111,6 +111,15 @@ ck_fifo_spsc_init(struct ck_fifo_spsc *fifo, struct ck_fifo_spsc_entry *stub)
return; 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_CC_INLINE static void
ck_fifo_spsc_enqueue(struct ck_fifo_spsc *fifo, ck_fifo_spsc_enqueue(struct ck_fifo_spsc *fifo,
struct ck_fifo_spsc_entry *entry, 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; 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_CC_INLINE static void
ck_fifo_mpmc_enqueue(struct ck_fifo_mpmc *fifo, ck_fifo_mpmc_enqueue(struct ck_fifo_mpmc *fifo,
struct ck_fifo_mpmc_entry *entry, struct ck_fifo_mpmc_entry *entry,

Loading…
Cancel
Save