void operator()(SharedState& shared_state, typename std::enable_if< traits::is_shared_state<SharedState>::value >::type* = nullptr) const { std::size_t counter = wait_.count_.load(boost::memory_order_seq_cst); if (counter < wait_.needed_count_ && !shared_state->is_ready()) { // handle future only if not enough futures are ready yet // also, do not touch any futures which are already ready shared_state->execute_deferred(); // execute_deferred might have made the future ready if (!shared_state->is_ready()) { shared_state->set_on_completed( util::deferred_call( &wait_some<Sequence>::on_future_ready, wait_.shared_from_this(), threads::get_self_id())); return; } } if (wait_.count_.fetch_add(1) + 1 == wait_.needed_count_) { wait_.goal_reached_on_calling_thread_ = true; } }
void operator()(SharedState& shared_state) const { std::size_t counter = wait_.count_.load(boost::memory_order_seq_cst); if (counter < wait_.needed_count_ && !shared_state->is_ready()) { // handle future only if not enough futures are ready yet // also, do not touch any futures which are already ready shared_state->execute_deferred(); // execute_deferred might have made the future ready if (!shared_state->is_ready()) { shared_state->set_on_completed(Callback(callback_)); return; } } if (wait_.count_.fetch_add(1) + 1 == wait_.needed_count_) { wait_.goal_reached_on_calling_thread_ = true; } }