public:
sync_queue()
{
- node* n = new node(NULL, NULL);
+ node* n = new node(NULL);
head.store(n);
tail.store(n);
}
bool push(const T& val)
{
node* old_tail = tail.load();
- node* n = new node(val, NULL);
+ node* n = new node(val);
old_tail->next = n;
tail.store(n);
return (old_tail == head.load());
private:
struct node {
- node(const T& v, node* n): value(v), next(n) { }
+ node(const T& v): value(v), next(NULL) { }
T value;
node* next;
};