From 64ff82ecf98ceb4725f0f51c73e23d1efc2160bc Mon Sep 17 00:00:00 2001 From: Michael Bebenita Date: Tue, 24 Aug 2010 21:06:56 -0700 Subject: Implemented an lock free queue based on this paper http://www.cs.rochester.edu/~scott/papers/1996_PODC_queues.pdf, the "lock free queue" we had before wasn't lock free at all. --- src/rt/sync/interrupt_transparent_queue.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/rt/sync/interrupt_transparent_queue.h (limited to 'src/rt/sync/interrupt_transparent_queue.h') diff --git a/src/rt/sync/interrupt_transparent_queue.h b/src/rt/sync/interrupt_transparent_queue.h new file mode 100644 index 00000000..7c02d0c8 --- /dev/null +++ b/src/rt/sync/interrupt_transparent_queue.h @@ -0,0 +1,22 @@ +#ifndef INTERRUPT_TRANSPARENT_QUEUE_H +#define INTERRUPT_TRANSPARENT_QUEUE_H + +#include "spin_lock.h" + +class interrupt_transparent_queue_node { +public: + interrupt_transparent_queue_node *next; + interrupt_transparent_queue_node(); +}; + +class interrupt_transparent_queue : interrupt_transparent_queue_node { + spin_lock lock; + interrupt_transparent_queue_node *_tail; +public: + interrupt_transparent_queue(); + void enqueue(interrupt_transparent_queue_node *item); + interrupt_transparent_queue_node *dequeue(); + bool is_empty(); +}; + +#endif /* INTERRUPT_TRANSPARENT_QUEUE_H */ -- cgit v1.2.3