[#run]
== cobalt/run.hpp

The `run` function is similar to <<spawn, 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.

[#run-outline]
=== Outline

[source,cpp]
----
// Run the task and return it's value or rethrow any exception.
T run(task<T> t);
----

[#run-example]
=== Example

[source,cpp]
----
cobalt::task<int> work();

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

