|
vitrio 0.1.4
High-throughput image I/O for Cryo-Electron Microscopy (CryoEM)
|
A completion that resolves once a fixed number of units of work have all reported in. More...
#include <vitrio/concurrency/counting_completion.hpp>


Public Member Functions | |
| counting_completion (std::size_t count) | |
| Construct a completion for a known number of units of work. | |
| counting_completion (const counting_completion &other)=delete | |
| counting_completion (counting_completion &&other)=delete | |
| counting_completion & | operator= (const counting_completion &other)=delete |
| counting_completion & | operator= (counting_completion &&other)=delete |
| void | notify_done (std::exception_ptr error=nullptr) override |
| Report that one unit of work has finished. | |
| void | wait () const override |
| Block the calling thread until this is ready. | |
| bool | is_ready () const noexcept override |
| Whether the work behind this has finished. | |
| void | get () const override |
| Wait, then rethrow the first exception recorded, if any. | |
Public Member Functions inherited from vitrio::completion | |
| completion (const completion &other)=default | |
| completion (completion &&other)=default | |
| completion & | operator= (const completion &other)=default |
| completion & | operator= (completion &&other)=default |
Public Member Functions inherited from vitrio::completion_notifier | |
| completion_notifier (const completion_notifier &other)=default | |
| completion_notifier (completion_notifier &&other)=default | |
| completion_notifier & | operator= (const completion_notifier &other)=default |
| completion_notifier & | operator= (completion_notifier &&other)=default |
A completion that resolves once a fixed number of units of work have all reported in.
A semaphore-style countdown from a starting count to zero, not a counter compared against a separately kept target. Resolves only once every unit of work has reported, regardless of which ones failed or when, so a caller of completion::wait never observes this ready while another unit of work behind it is still running. The first exception reported, if any, is what get rethrows; the rest are discarded.
Implements both completion and completion_notifier so that the same object serves both audiences, each reached through the interface meant for it: the query side goes to whoever asked for the work, the notifying side goes to the executor running it.
|
explicit |
Construct a completion for a known number of units of work.
A count of zero constructs a completion that is already resolved.
| count | How many times notify_done is reported before this resolves. |
|
overridevirtual |
Wait, then rethrow the first exception recorded, if any.
| Whatever | the first unit of work to fail threw. |
Implements vitrio::completion.
|
overridevirtualnoexcept |
Whether the work behind this has finished.
Implements vitrio::completion.
Report that one unit of work has finished.
Called exactly once per unit of work this notifier stands for.
| error | The exception the unit of work raised, or null if it succeeded. |
Implements vitrio::completion_notifier.
|
overridevirtual |
Block the calling thread until this is ready.
Implements vitrio::completion.