2
0
mirror of https://github.com/boostorg/cobalt.git synced 2026-01-19 16:12:15 +00:00
Files
cobalt/doc/reference/run.adoc
Klemens Morgenstern 45901641ac renamed to cobalt.
2023-10-16 21:42:07 +08:00

31 lines
540 B
Plaintext

[#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());
}
----