--- /dev/null
+#include <cds/gc/dhp.h>
+#include <cds/gc/hp.h>
+#include <cds/init.h>
+#include <cds/intrusive/msqueue.h>
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+namespace ci = cds::intrusive;
+typedef cds::gc::HP hp_gc;
+
+struct Foo : public ci::msqueue::node<hp_gc> {
+ Foo(int x) : x(x) {}
+ int x;
+};
+
+// Declare traits for the queue
+struct MyTraits : public cds::intrusive::msqueue::traits {
+ typedef cds::intrusive::msqueue::stat<> stat;
+ typedef cds::atomicity::item_counter item_counter;
+};
+
+// At least, declare the queue type
+typedef ci::MSQueue<hp_gc, Foo, MyTraits> MyQueue;
+
+int main() {
+ cds::Initialize();
+
+ {
+ // Initialize Hazard Pointer singleton
+ cds::gc::HP hpGC(128, 8, 128);
+ // If main thread uses lock-free containers
+ // the main thread should be attached to libcds infrastructure
+ cds::threading::Manager::attachThread();
+
+ MyQueue q;
+ Foo *f = new Foo(1);
+ Foo *res = nullptr;
+ q.enqueue(*f);
+ res = q.dequeue();
+ if (res) {
+ cout << "Dequeued " << res->x << "\n";
+ } else {
+ cout << "Dequeued none\n";
+ }
+ }
+
+ cds::Terminate();
+ return 0;
+}