bool test () { if (LOOM_UNLIKELY(not stale_count_) and LOOM_LIKELY(fresh_count_)) { stale_count_ = fresh_count_; fresh_count_ = 0; return true; } else { return false; } }
void unsafe_add_thread ( size_t stage_number, const ThreadState & init_thread, const Fun & fun) { queue_.unsafe_add_consumer(stage_number); size_t init_position = queue_.unsafe_position(); threads_.push_back(std::thread( [this, stage_number, init_thread, init_position, fun](){ ThreadState thread = init_thread; size_t position = init_position; for (bool alive = true; LOOM_LIKELY(alive);) { queue_.consume(stage_number, position, [&](PipelineTask & task){ if (LOOM_UNLIKELY(task.exit)) { alive = false; } else { fun(task.task, thread); } }); ++position; } })); }