Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <iosfwd>
7 : #include <optional>
8 : #include <tuple>
9 :
10 : namespace Parallel {
11 :
12 : /// The possible options for altering the current execution of the algorithm,
13 : /// used in the return type of iterable actions.
14 1 : enum class AlgorithmExecution {
15 : /// Continue executing iterable actions.
16 : Continue,
17 : /// Temporarily stop executing iterable actions, but try the same
18 : /// action again after receiving data from other distributed
19 : /// objects.
20 : Retry,
21 : /// Stop the execution of iterable actions, but allow entry methods
22 : /// (communication) to explicitly request restarting the execution.
23 : Pause,
24 : /// Stop the execution of iterable actions and do not allow their execution
25 : /// until after a phase change. Simple actions will still execute.
26 : Halt
27 : };
28 :
29 : /// Return type for iterable actions. The std::optional can be used to specify
30 : /// the index of the action to be called next in the phase dependent action
31 : /// list. Passing std::nullopt will execute the next action in the list.
32 1 : using iterable_action_return_t =
33 : std::tuple<AlgorithmExecution, std::optional<size_t>>;
34 : } // namespace Parallel
|