C++11的并发框架:Async++

jopen 12年前

Async++是一个轻量级的C++11并发框架。其思想源于Microsoft PPL libraryN3428 C++标准提案。

// Create a task which runs asynchronously  auto my_task = async::spawn([] {      return 42;  });    // Do other stuff while the task is not finished  while (!my_task.ready()) {      // Do stuff...  }    // Wait for the task to complete without getting the result  my_task.wait();    // Wait for the task to complete and get the result  int answer = my_task.get();    // Create a task with a preset value  auto my_task2 = async::make_task(42);    // Print the value stored in the task  std::cout << my_task2.get() << std::endl;

项目主页:http://www.open-open.com/lib/view/home/1362732394968