diff --git a/README.md b/README.md index 224d0bf..d1cac4c 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ * プロジェクトページ: https://github.com/sile/ipc-msgque ## バージョン -* 0.1.1 +* 0.1.2 ## 対応環境 * gccのver4.1以上 diff --git a/include/imque/allocator/variable_allocator.hh b/include/imque/allocator/variable_allocator.hh index 140f54d..5808448 100644 --- a/include/imque/allocator/variable_allocator.hh +++ b/include/imque/allocator/variable_allocator.hh @@ -182,7 +182,8 @@ namespace imque { node.version++; node.setRefCount(1); - assert(snap.compare_and_swap(node)); // 他と競合するような使い方をしてはいけない + bool rlt = snap.compare_and_swap(node); // 他と競合するような使い方をしてはいけない + assert(rlt); desc.version++; return desc.encode(); diff --git a/include/imque/queue/queue_impl.hh b/include/imque/queue/queue_impl.hh index 53cee5d..e7e9561 100644 --- a/include/imque/queue/queue_impl.hh +++ b/include/imque/queue/queue_impl.hh @@ -10,7 +10,7 @@ namespace imque { namespace queue { - static const char MAGIC[] = "IMQUE-0.1.1"; + static const char MAGIC[] = "IMQUE-0.1.2"; // FIFOキュー class QueueImpl { @@ -45,7 +45,8 @@ namespace imque { ~NodeRef() { if(md_) { - assert(alc_.release(md_)); + bool rlt = alc_.release(md_); + assert(rlt); } } @@ -88,7 +89,8 @@ namespace imque { que_->head = sentinel; que_->tail = sentinel; - assert(alc_.dup(sentinel)); // head と tail の二箇所から参照されているので、参照カウントを一つ増やしておく + bool rlt = alc_.dup(sentinel); // head と tail の二箇所から参照されているので、参照カウントを一つ増やしておく + assert(rlt); que_->overflowed_count = 0; } @@ -146,7 +148,8 @@ namespace imque { Node* node = alc_.ptr(md); buf.assign(node->data, node->data_size); - assert(alc_.release(md)); + bool rlt = alc_.release(md); + assert(rlt); return true; } @@ -170,7 +173,8 @@ namespace imque { private: void enqImpl(uint32_t new_tail) { - assert(alc_.dup(new_tail, 2)); // head と tail からの参照分を始めにカウントしておく + bool rlt = alc_.dup(new_tail, 2); // head と tail からの参照分を始めにカウントしておく + assert(rlt); for(;;) { NodeRef tail_ref(que_->tail, alc_); @@ -212,7 +216,8 @@ namespace imque { bool tryMoveNext(volatile uint32_t* place, uint32_t curr, uint32_t next) { if(atomic::compare_and_swap(place, curr, next)) { - assert(alc_.release(curr)); + bool rlt = alc_.release(curr); + assert(rlt); return true; } return false;