projects
/
model-checker-benchmarks.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
bench.sh: rewrite benchmark list to match paper
[model-checker-benchmarks.git]
/
spsc-queue
/
queue.h
diff --git
a/spsc-queue/queue.h
b/spsc-queue/queue.h
index d65477bf71d99f62edb54220cd2447b5611fcc52..c77425f5b662f1de1982e9738ede23bcff4e4a07 100644
(file)
--- a/
spsc-queue/queue.h
+++ b/
spsc-queue/queue.h
@@
-1,3
+1,6
@@
+#include <unrelacy.h>
+#include <atomic>
+
#include "eventcount.h"
template<typename T>
#include "eventcount.h"
template<typename T>
@@
-6,22
+9,22
@@
class spsc_queue
public:
spsc_queue()
{
public:
spsc_queue()
{
- node* n =
RL_NEW
node ();
- head
($)
= n;
- tail
($)
= n;
+ node* n =
new
node ();
+ head = n;
+ tail = n;
}
~spsc_queue()
{
}
~spsc_queue()
{
- RL_ASSERT(head
($) == tail($)
);
-
RL_DELETE
((node*)head($));
+ RL_ASSERT(head
== tail
);
+
delete
((node*)head($));
}
void enqueue(T data)
{
}
void enqueue(T data)
{
- node* n =
RL_NEW
node (data);
- head($)->next
($)
.store(n, std::memory_order_release);
- head
($)
= n;
+ node* n =
new
node (data);
+ head($)->next.store(n, std::memory_order_release);
+ head = n;
ec.signal_relaxed();
}
ec.signal_relaxed();
}
@@
-49,9
+52,10
@@
private:
rl::var<T> data;
node(T data = T())
rl::var<T> data;
node(T data = T())
- : next(0)
- , data(data)
- {}
+ : data(data)
+ {
+ next = 0;
+ }
};
rl::var<node*> head;
};
rl::var<node*> head;
@@
-62,12
+66,12
@@
private:
T try_dequeue()
{
node* t = tail($);
T try_dequeue()
{
node* t = tail($);
- node* n = t->next
($)
.load(std::memory_order_acquire);
+ node* n = t->next.load(std::memory_order_acquire);
if (0 == n)
return 0;
T data = n->data($);
if (0 == n)
return 0;
T data = n->data($);
-
RL_DELETE
(t);
- tail
($)
= n;
+
delete
(t);
+ tail = n;
return data;
}
};
return data;
}
};