ck_fifo: Use ck_spinlock instead of specific spinlock implementation.

ck_pring
Samy Al Bahra 13 years ago
parent 381572e13f
commit 01d368b703

@ -44,10 +44,10 @@ struct ck_fifo_spsc_entry {
typedef struct ck_fifo_spsc_entry ck_fifo_spsc_entry_t; typedef struct ck_fifo_spsc_entry ck_fifo_spsc_entry_t;
struct ck_fifo_spsc { struct ck_fifo_spsc {
ck_spinlock_fas_t m_head; ck_spinlock_t m_head;
struct ck_fifo_spsc_entry *head; struct ck_fifo_spsc_entry *head;
char pad[CK_MD_CACHELINE - sizeof(struct ck_fifo_spsc_entry *) - sizeof(ck_spinlock_fas_t)]; char pad[CK_MD_CACHELINE - sizeof(struct ck_fifo_spsc_entry *) - sizeof(ck_spinlock_t)];
ck_spinlock_fas_t m_tail; ck_spinlock_t m_tail;
struct ck_fifo_spsc_entry *tail; struct ck_fifo_spsc_entry *tail;
struct ck_fifo_spsc_entry *head_snapshot; struct ck_fifo_spsc_entry *head_snapshot;
struct ck_fifo_spsc_entry *garbage; struct ck_fifo_spsc_entry *garbage;
@ -58,14 +58,14 @@ CK_CC_INLINE static bool
ck_fifo_spsc_enqueue_trylock(struct ck_fifo_spsc *fifo) ck_fifo_spsc_enqueue_trylock(struct ck_fifo_spsc *fifo)
{ {
return ck_spinlock_fas_trylock(&fifo->m_tail); return ck_spinlock_trylock(&fifo->m_tail);
} }
CK_CC_INLINE static void CK_CC_INLINE static void
ck_fifo_spsc_enqueue_lock(struct ck_fifo_spsc *fifo) ck_fifo_spsc_enqueue_lock(struct ck_fifo_spsc *fifo)
{ {
ck_spinlock_fas_lock(&fifo->m_tail); ck_spinlock_lock(&fifo->m_tail);
return; return;
} }
@ -73,7 +73,7 @@ CK_CC_INLINE static void
ck_fifo_spsc_enqueue_unlock(struct ck_fifo_spsc *fifo) ck_fifo_spsc_enqueue_unlock(struct ck_fifo_spsc *fifo)
{ {
ck_spinlock_fas_unlock(&fifo->m_tail); ck_spinlock_unlock(&fifo->m_tail);
return; return;
} }
@ -81,14 +81,14 @@ CK_CC_INLINE static bool
ck_fifo_spsc_dequeue_trylock(struct ck_fifo_spsc *fifo) ck_fifo_spsc_dequeue_trylock(struct ck_fifo_spsc *fifo)
{ {
return ck_spinlock_fas_trylock(&fifo->m_head); return ck_spinlock_trylock(&fifo->m_head);
} }
CK_CC_INLINE static void CK_CC_INLINE static void
ck_fifo_spsc_dequeue_lock(struct ck_fifo_spsc *fifo) ck_fifo_spsc_dequeue_lock(struct ck_fifo_spsc *fifo)
{ {
ck_spinlock_fas_lock(&fifo->m_head); ck_spinlock_lock(&fifo->m_head);
return; return;
} }
@ -96,7 +96,7 @@ CK_CC_INLINE static void
ck_fifo_spsc_dequeue_unlock(struct ck_fifo_spsc *fifo) ck_fifo_spsc_dequeue_unlock(struct ck_fifo_spsc *fifo)
{ {
ck_spinlock_fas_unlock(&fifo->m_head); ck_spinlock_unlock(&fifo->m_head);
return; return;
} }
@ -104,8 +104,8 @@ CK_CC_INLINE static void
ck_fifo_spsc_init(struct ck_fifo_spsc *fifo, struct ck_fifo_spsc_entry *stub) ck_fifo_spsc_init(struct ck_fifo_spsc *fifo, struct ck_fifo_spsc_entry *stub)
{ {
ck_spinlock_fas_init(&fifo->m_head); ck_spinlock_init(&fifo->m_head);
ck_spinlock_fas_init(&fifo->m_tail); ck_spinlock_init(&fifo->m_tail);
ck_pr_store_ptr(&stub->next, NULL); ck_pr_store_ptr(&stub->next, NULL);
ck_pr_store_ptr(&fifo->head, stub); ck_pr_store_ptr(&fifo->head, stub);
ck_pr_store_ptr(&fifo->tail, stub); ck_pr_store_ptr(&fifo->tail, stub);

Loading…
Cancel
Save