projects
/
model-checker-benchmarks.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
spsc-queue: unrelacy
[model-checker-benchmarks.git]
/
spsc-queue
/
queue.h
diff --git
a/spsc-queue/queue.h
b/spsc-queue/queue.h
index d65477bf71d99f62edb54220cd2447b5611fcc52..7a6f29e80c60bd6d9f9b0ef6e5571aae5501db4e 100644
(file)
--- a/
spsc-queue/queue.h
+++ b/
spsc-queue/queue.h
@@
-1,3
+1,5
@@
+#include <unrelacy.h>
+
#include "eventcount.h"
template<typename T>
#include "eventcount.h"
template<typename T>
@@
-7,21
+9,21
@@
public:
spsc_queue()
{
node* n = RL_NEW node ();
spsc_queue()
{
node* n = RL_NEW node ();
- head
($)
= n;
- tail
($)
= n;
+ head = n;
+ tail = n;
}
~spsc_queue()
{
}
~spsc_queue()
{
- RL_ASSERT(head
($) == tail($)
);
+ RL_ASSERT(head
== tail
);
RL_DELETE((node*)head($));
}
void enqueue(T data)
{
node* n = RL_NEW node (data);
RL_DELETE((node*)head($));
}
void enqueue(T data)
{
node* n = RL_NEW node (data);
- head($)->next
($)
.store(n, std::memory_order_release);
- head
($)
= n;
+ head($)->next.store(n, std::memory_order_release);
+ head = n;
ec.signal_relaxed();
}
ec.signal_relaxed();
}
@@
-62,12
+64,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($);
RL_DELETE(t);
if (0 == n)
return 0;
T data = n->data($);
RL_DELETE(t);
- tail
($)
= n;
+ tail = n;
return data;
}
};
return data;
}
};