aboutsummaryrefslogtreecommitdiff
path: root/src/rt/sync/interrupt_transparent_queue.cpp
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2010-09-08 19:13:49 -0700
committerGraydon Hoare <[email protected]>2010-09-08 19:13:49 -0700
commit616b7afb724a32df41eebfaf95402d008c60b411 (patch)
tree03e13578e8b43b9001cef983d1117800a6f93e65 /src/rt/sync/interrupt_transparent_queue.cpp
parentXFAIL many.rs since it crashes on win32, and add a time-slice sleep to the ke... (diff)
downloadrust-616b7afb724a32df41eebfaf95402d008c60b411.tar.xz
rust-616b7afb724a32df41eebfaf95402d008c60b411.zip
Tidy up the sync dir, remove dead or mis-designed code in favour of OS primitives, switch rust_kernel to use a lock/signal pair and wait rather than spin.
Diffstat (limited to 'src/rt/sync/interrupt_transparent_queue.cpp')
-rw-r--r--src/rt/sync/interrupt_transparent_queue.cpp56
1 files changed, 0 insertions, 56 deletions
diff --git a/src/rt/sync/interrupt_transparent_queue.cpp b/src/rt/sync/interrupt_transparent_queue.cpp
deleted file mode 100644
index 064b25f1..00000000
--- a/src/rt/sync/interrupt_transparent_queue.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Interrupt transparent queue, Schoen et. al, "On Interrupt-Transparent
- * Synchronization in an Embedded Object-Oriented Operating System", 2000.
- * enqueue() is allowed to interrupt enqueue() and dequeue(), however,
- * dequeue() is not allowed to interrupt itself.
- */
-
-#include "../globals.h"
-#include "interrupt_transparent_queue.h"
-
-interrupt_transparent_queue_node::interrupt_transparent_queue_node() :
- next(NULL) {
-
-}
-
-interrupt_transparent_queue::interrupt_transparent_queue() : _tail(this) {
-
-}
-
-void
-interrupt_transparent_queue::enqueue(interrupt_transparent_queue_node *item) {
- lock.lock();
- item->next = (interrupt_transparent_queue_node *) NULL;
- interrupt_transparent_queue_node *last = _tail;
- _tail = item;
- while (last->next) {
- last = last->next;
- }
- last->next = item;
- lock.unlock();
-}
-
-interrupt_transparent_queue_node *
-interrupt_transparent_queue::dequeue() {
- lock.lock();
- interrupt_transparent_queue_node *item = next;
- if (item && !(next = item->next)) {
- _tail = (interrupt_transparent_queue_node *) this;
- if (item->next) {
- interrupt_transparent_queue_node *lost = item->next;
- interrupt_transparent_queue_node *help;
- do {
- help = lost->next;
- enqueue(lost);
- } while ((lost = help) !=
- (interrupt_transparent_queue_node *) NULL);
- }
- }
- lock.unlock();
- return item;
-}
-
-bool
-interrupt_transparent_queue::is_empty() {
- return next == NULL;
-}