[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/haohuixin/cpp-taskflow/master/example/dispatch.cpp [Back]  [Original]

// 2018/11/13 - created by Chun-Xun Lin
//
// The program demonstrates how to use asynchronous dispatch
// with callback invoked on finish.

#include 
#include 

int main() {

  using namespace std::literals::chrono_literals;

  tf::Taskflow tf;

  const size_t num_jobs {10000};

  std::atomic counter {0};
  std::random_device rd;  
  std::mt19937 gen(rd()); 
  std::uniform_int_distribution dice(1, 100);

  // Insert tasks with sleeping for random ms and increasing the counter
  for(size_t i=0; i

Web Proxy Viewer  |  New URL  |  Original Page