Most call _is_all_kv_submitted under the situation: q.empty() is false.
Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
}
bool _is_all_kv_submitted() {
- // caller must hold qlock
- if (q.empty()) {
- return true;
- }
+ // caller must hold qlock & q.empty() must not empty
+ assert(!q.empty());
TransContext *txc = &q.back();
if (txc->state >= TransContext::STATE_KV_SUBMITTED) {
return true;
// may become true outside qlock, and we need to make
// sure those threads see waiters and signal qcond.
++kv_submitted_waiters;
- if (_is_all_kv_submitted()) {
+ if (q.empty() || _is_all_kv_submitted()) {
--kv_submitted_waiters;
return;
}