diff --git a/include/circ_queue.h b/include/circ_queue.h index 0230253..758905b 100644 --- a/include/circ_queue.h +++ b/include/circ_queue.h @@ -36,8 +36,6 @@ public: swap(rhs); } - ~queue(void) { detach(); } - void swap(queue& rhs) { std::swap(elems_ , rhs.elems_ ); std::swap(cursor_, rhs.cursor_); @@ -96,7 +94,7 @@ public: while (cursor_ == elems_->cursor()) { std::this_thread::yield(); } - auto item_ptr = static_cast(elems_->take(cursor_)); + auto item_ptr = static_cast(elems_->take(cursor_++)); T item = *item_ptr; elems_->put(item_ptr); return item; diff --git a/test/test_circ.cpp b/test/test_circ.cpp index a535335..0c1736c 100644 --- a/test/test_circ.cpp +++ b/test/test_circ.cpp @@ -88,7 +88,9 @@ struct test_confirm { int lcount_; test_confirm(int M) { - list_ = new std::remove_reference_t[lcount_ = M]; + list_ = new std::remove_reference_t[ + static_cast(lcount_ = M) + ]; } ~test_confirm(void) { @@ -315,7 +317,7 @@ void Unit::test_queue(void) { queue.attch(cq); QVERIFY(queue.detach() != nullptr); - test_prod_cons<1, 1>((ipc::circ::queue*)nullptr); + test_prod_cons<1, 3>((ipc::circ::queue*)nullptr); } } // internal-linkage