diff --git a/libraries/concurrency/channel/process/process_example.cpp b/libraries/concurrency/channel/process/process_example.cpp index e0ba0a0..4be649c 100644 --- a/libraries/concurrency/channel/process/process_example.cpp +++ b/libraries/concurrency/channel/process/process_example.cpp @@ -1,4 +1,6 @@ +#include #include +#include #include #include @@ -35,17 +37,26 @@ struct adder int main() { sender send; - receiver receiver; + receiver receiver; std::tie(send, receiver) = channel(default_executor); - auto calculator = receiver | adder{} | - [](int x) { std::cout << x << '\n'; }; + std::atomic_bool done{false}; + + auto calculator = receiver | + adder{} | + [&_done = done](int x) { std::cout << x << '\n'; + _done = true; + }; receiver.set_ready(); - while (true) { - int x; - std::cin >> x; - send(x); - } + send(1); + send(2); + send(3); + send(0); + + // Waiting just for illustrational purpose + while (!done) { + std::this_thread::sleep_for(std::chrono::milliseconds(1)); + } } \ No newline at end of file diff --git a/libraries/concurrency/channel/receiver/executor/executor.md b/libraries/concurrency/channel/receiver/executor/executor.md index 0c0dfa4..0a77f42 100644 --- a/libraries/concurrency/channel/receiver/executor/executor.md +++ b/libraries/concurrency/channel/receiver/executor/executor.md @@ -6,7 +6,8 @@ scope: stlab pure-name: executor defined-in-header: stlab/concurrency/channel.hpp declaration: executor() -description: Constructs a new executor object +brief: Constructs a new executor wrapper object +description: Constructs a new executor wrapper object entities: - kind: methods list: diff --git a/libraries/concurrency/channel/receiver/executor/index.md b/libraries/concurrency/channel/receiver/executor/index.md index bc9a356..5ca528d 100644 --- a/libraries/concurrency/channel/receiver/executor/index.md +++ b/libraries/concurrency/channel/receiver/executor/index.md @@ -8,6 +8,7 @@ pure-name: executor defined-in-header: stlab/concurrency/channel.hpp git-link: https://github.com/stlab/libraries/blob/develop/stlab/concurrency/channel.hpp declaration: struct executor +brief: Executor wrapper class description: This class has only one purpose, to encapsulate an executor to be piped to a `receiver` dtor: default example: executor_example.cpp diff --git a/libraries/concurrency/channel/receiver/operator_pipe.md b/libraries/concurrency/channel/receiver/operator_pipe.md index f169f78..1843d23 100644 --- a/libraries/concurrency/channel/receiver/operator_pipe.md +++ b/libraries/concurrency/channel/receiver/operator_pipe.md @@ -6,7 +6,7 @@ scope: receiver pure-name: operator| defined-in-header: stlab/concurrency/channel.hpp declaration: operator|() -brief: Creates a new receiver with the given process attached downstream. +brief: Attaches a new process to the channel. description: Creates a new receiver, attaches the given process as downstream to it and returns this new receiver. The new receiver inherits the executor from its upstream receiver if not an alternative executor is attached. In case that `T` of `receiver` is a move only type, repeated calls of this operator overwrite the previous attached downstream channel. example: operator_pipe_example.cpp entities: diff --git a/libraries/concurrency/channel/receiver/set_ready.md b/libraries/concurrency/channel/receiver/set_ready.md index 0c20da3..4a79fd2 100644 --- a/libraries/concurrency/channel/receiver/set_ready.md +++ b/libraries/concurrency/channel/receiver/set_ready.md @@ -6,7 +6,8 @@ scope: receiver pure-name: set_ready defined-in-header: stlab/concurrency/channel.hpp declaration: set_ready -description: Sets this receiver ready to receive values. +brief: Sets the receiver ready to receive values. +description: Sets the receiver ready to receive values. example: set_ready_example.cpp entities: - kind: methods diff --git a/libraries/concurrency/channel/sender/operator().md b/libraries/concurrency/channel/sender/operator().md index 0d96d3f..0332570 100644 --- a/libraries/concurrency/channel/sender/operator().md +++ b/libraries/concurrency/channel/sender/operator().md @@ -6,6 +6,7 @@ scope: sender pure-name: operator() defined-in-header: stlab/concurrency/channel.hpp declaration: operator() +brief: Sends a new value into the channel description: Sends a new value into the channel example: call_operator_example.cpp entities: diff --git a/libraries/concurrency/channel/zip.md b/libraries/concurrency/channel/zip.md index b8fbade..1579c65 100644 --- a/libraries/concurrency/channel/zip.md +++ b/libraries/concurrency/channel/zip.md @@ -4,7 +4,7 @@ title: stlab::zip tags: [library] scope: stlab pure-name: zip -brief: Creates a future that zips all passed arguments +brief: It creates a process that zips all passed arguments and returns a receiver. annotation: template function example: zip_example.cpp entities: diff --git a/libraries/concurrency/executor/default_executor/index.md b/libraries/concurrency/executor/default_executor/index.md index abc89f1..a6e0266 100644 --- a/libraries/concurrency/executor/default_executor/index.md +++ b/libraries/concurrency/executor/default_executor/index.md @@ -6,7 +6,8 @@ name: stlab::default_executor pure-name: default_executor defined-in-header: executor/concurrency/default_executor.hpp declaration: struct default_executor -description: Executes functions on the system's thread pool +brief: Interface to the system's thread pool +description: Executes functions on the system's thread pool. On MacOS, Windows, Emscripten and PNaCl the OS integrated thread pool is the base of this class. For other OS an custom thread pool is provided. member-types: - type: result_type definition: void diff --git a/libraries/concurrency/executor/index.md b/libraries/concurrency/executor/index.md index ba971a2..a123aba 100644 --- a/libraries/concurrency/executor/index.md +++ b/libraries/concurrency/executor/index.md @@ -2,7 +2,7 @@ layout: library title: Executors tags: [library] -brief: Executors. They execute. +brief: A collection of executors with different strategies to run tasks. description: | Executors provide a means of running functions using different execution policies via a consistent interface. --- diff --git a/libraries/concurrency/future/future/recover.md b/libraries/concurrency/future/future/recover.md index 2160def..f4de2a5 100644 --- a/libraries/concurrency/future/future/recover.md +++ b/libraries/concurrency/future/future/recover.md @@ -6,7 +6,8 @@ scope: future pure-name: recover defined-in-header: stlab/concurrency/future.hpp declaration: recover() -description: Creates a recoverable continuation on the current object. +brief: Creates a recoverable future on the current object. +description: Since the futures are value based, the recover method should be used to do the error handling. example: recover_example.cpp entities: - kind: methods @@ -45,4 +46,7 @@ entities: description: Executor which is used to schedule the resulting task - name: f description: Callable object that implements the `recover()` function. Its parameter must be of type of this `future` instance. + - kind: result + description: It returns the recoverable future + --- diff --git a/libraries/concurrency/future/future/then.md b/libraries/concurrency/future/future/then.md index b5201f4..daf9330 100644 --- a/libraries/concurrency/future/future/then.md +++ b/libraries/concurrency/future/future/then.md @@ -5,7 +5,7 @@ tags: [library] scope: future pure-name: then defined-in-header: stlab/concurrency/future.hpp -brief: Creates a continuation +brief: Creates a continuation on the current future. declaration: then() example: [then_continuation_example.cpp, then_split_example.cpp] description: | diff --git a/libraries/concurrency/index.md b/libraries/concurrency/index.md index 9e5dcad..af55763 100644 --- a/libraries/concurrency/index.md +++ b/libraries/concurrency/index.md @@ -9,6 +9,11 @@ description: | Since one can create with futures only graphs for single use, this library provides as well channels. With these channels one can build graphs, that can be used for multiple invocations. --- +### Source Code + +The source code is hosted on [github](https://github.com/stlab/libraries). + + {% include example_table.html %} ### Requirements @@ -17,4 +22,4 @@ description: | * boost 1.60.0 (optional, variant and test for executing the UnitTests) ### Authors -Sean Parent, Felix Petriconi +Sean Parent, Foster Brereton, Felix Petriconi