From 5b37b97f7e9b014ad52d43685c6909d2615cdc92 Mon Sep 17 00:00:00 2001 From: Samy Al Bahra Date: Thu, 21 Jul 2011 17:19:43 -0400 Subject: [PATCH] ck_fifo: Add fifo trylock variant. --- include/ck_fifo.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/ck_fifo.h b/include/ck_fifo.h index 3167cab..22744e9 100644 --- a/include/ck_fifo.h +++ b/include/ck_fifo.h @@ -54,6 +54,13 @@ struct ck_fifo_spsc { }; typedef struct ck_fifo_spsc ck_fifo_spsc_t; +CK_CC_INLINE static bool +ck_fifo_spsc_enqueue_trylock(struct ck_fifo_spsc *fifo) +{ + + return ck_spinlock_fas_trylock(&fifo->m_tail); +} + CK_CC_INLINE static void ck_fifo_spsc_enqueue_lock(struct ck_fifo_spsc *fifo) {