1 #include <cds/gc/dhp.h>
4 #include <cds/intrusive/vyukov_mpmc_cycle_queue.h>
10 namespace ci = cds::intrusive;
11 typedef cds::gc::HP hp_gc;
18 typedef cds::intrusive::VyukovMPMCCycleQueue<
19 Foo, typename cds::intrusive::vyukov_queue::make_traits<cds::opt::buffer<
20 cds::opt::v::uninitialized_static_buffer<Foo, 1024>>>::type>
23 // Queue of Foo pointers, capacity is 1024, dynamically allocated buffer:
24 struct queue_traits : public cds::intrusive::vyukov_queue::traits {
25 typedef cds::opt::v::uninitialized_dynamic_buffer<Foo> buffer;
27 typedef cds::intrusive::VyukovMPMCCycleQueue<Foo, queue_traits> dynamic_queue;
33 // Initialize Hazard Pointer singleton
34 cds::gc::HP hpGC(128, 8, 128);
35 // If main thread uses lock-free containers
36 // the main thread should be attached to libcds infrastructure
37 cds::threading::Manager::attachThread();
45 cout << "Dequeued " << res->x << "\n";
47 cout << "Dequeued none\n";