Skip to content

Latest commit

 

History

History
30 lines (22 loc) · 540 Bytes

run.adoc

File metadata and controls

30 lines (22 loc) · 540 Bytes

cobalt/run.hpp

The run function is similar to spawn but running synchronously. It will internally setup an execution context and the memory resources.

This can be useful when integrating a piece of cobalt code into a synchronous application.

Outline

// Run the task and return it's value or rethrow any exception.
T run(task<T> t);

Example

cobalt::task<int> work();

int main(int argc, char *argv[])
{
  return run(work());
}