Concurrency
This library provides high level constructs for implementing algorithms that eases the use of multiple CPU cores while minimizing the contention.
The future implementation differs in several aspects compared to the C++11/14/17 standard futures: It provides continuations and joins, which were just added in a C++17 TS. But more important this futures propagate values through the graph and not futures. This allows an easy way of creating splits. That means a single future can have multiple continuations into different directions. An other important difference is that the futures support cancellation. So if one is not anymore interested in the result of a future, then one can destroy the future without the need to wait until the future is fulfilled, as it is the case with std::future
(and boost::future
). An already started future will run until its end, but will not trigger any continuation. So in all these cases, all chained continuations will never be triggered. Additionally the future interface is designed in a way, that one can use build in or custom build executors.
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.
Requirements
- C++14 compliant compiler (clang 3.6, gcc 5.3, Visual Studio 2015 Update 3)
- boost 1.60.0 (optional, variant and test for executing the UnitTests)
Authors
Sean Parent, Foster Brereton, Felix Petriconi
Examples
await
|
await_example.cpp |
Called on an await-process whenever a new value was received from upstream. | ||||||||||||||||||
stlab::buffer_size
|
buffer_size_example.cpp |
|||||||||||||||||||
process
|
process_example.cpp |
Describes a process that gets executed whenever a value is passed into the channel | ||||||||||||||||||
operator co_await
|
operator_co_await_example.cpp |
Creates a awaitable object on a given future. | ||||||||||||||||||
then
|
then_continuation_example.cpp then_split_example.cpp |
Creates a continuation on the current future. | ||||||||||||||||||
operator^()
|
recover_example.cpp |
Creates a recoverable future on the current object. | ||||||||||||||||||
recover
|
recover_example.cpp |
Creates a recoverable future on the current object. | ||||||||||||||||||
then
|
then_continuation_example.cpp then_split_example.cpp |
Creates a continuation on the current future. | ||||||||||||||||||
operator|
|
operator_pipe_example.cpp |
Attaches a new process to the channel. | ||||||||||||||||||
set_ready
|
set_ready_example.cpp |
Sets the receiver ready to receive values. | ||||||||||||||||||
stlab::sender::operator()
|
call_operator_example.cpp |
Sends a new value into the channel | ||||||||||||||||||
stlab::async
|
async_example.cpp |
Run a function on a specified executor | ||||||||||||||||||
stlab::channel
|
channel_example.cpp |
Creates a pair that consists of a sender and a receiver | ||||||||||||||||||
stlab::executor
|
executor_example.cpp |
Executor wrapper class | ||||||||||||||||||
stlab::serial_queue
|
serial_queue_example.cpp |
An executor wrapper that causes enqueued tasks to be run serially. | ||||||||||||||||||
stlab::join
|
zip_with_example.cpp |
Creates a future that joins all passed arguments. This function is deprecated and it will soon be removed. Please use instead of `zip_with` | ||||||||||||||||||
stlab::merge
|
merge_channel_example.cpp |
Creates a receiver that merges all passed arguments. This function is deprecated and will be removed soon. Please instead `merge_channel
|
stlab::merge_channel
|
merge_channel_example.cpp
Creates a channel that merges all passed arguments
|
|
stlab::package
|
package_example.cpp
Create a packaged_task/future pair
|
|
stlab::when_all
|
when_all_example.cpp when_all_void_example.cpp
Creates a joining future
|
|
stlab::when_any
|
when_any_example.cpp when_any_void_example.cpp
Creates a future that continues on the first success of any futures passed
|
|
stlab::zip
|
zip_example.cpp
It zips the values in step from all upstream receivers. (The functionality has changed after release 1.2.0!)
|
|
stlab::zip_with
|
zip_with_example.cpp
Creates a channel that zips multiple channels into a single one
|
|
Classes
An executor wrapper that causes enqueued tasks to be run serially. (template class) |
Subcomponents
This library implements the channel model of interprocess communication. |
|
A collection of executors with different strategies to run tasks. |
|
Futures class and related functions |
|
Task class and related functions |