August 2017
Intermediate to advanced
438 pages
14h 19m
English
We do not need to block at all! Let's take a closer look at the example. All we need to do is to post four fill_data tasks and make the last finished task call compute_send_data(data).
#include <boost/atomic.hpp> typedef boost::atomic<unsigned int> atomic_count_t;
void clever_runner( std::size_t thread_index, std::size_t iteration, atomic_count_t& counter, data_t& data){ fill_data(data.at(thread_index)); if (++counter != data_t::static_size) { return; } compute_send_data(data); if (++iteration == 1000) { // Exiting, because ...Read now
Unlock full access