Commit d116440 1 parent f1fe41f commit d116440 Copy full SHA for d116440
File tree 2 files changed +5
-3
lines changed
include/boost/async/detail
2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -32,17 +32,18 @@ struct completion_handler_noop_executor : executor
32
32
template <typename Fn>
33
33
void execute (Fn && fn) const
34
34
{
35
+ // only allow it when we're still initializing
35
36
if (completed_immediately &&
36
- // avoid recursion. i.e. don't let multiple sup operations complete immediately.
37
- *completed_immediately != completed_immediately_t ::maybe)
37
+ ((*completed_immediately == completed_immediately_t ::initiating)
38
+ || ( *completed_immediately == completed_immediately_t ::maybe)) )
38
39
{
39
40
// only use this indicator if the fn will actually call our completion-handler
40
41
// otherwise this was a single op in a composed operation
41
42
*completed_immediately = completed_immediately_t ::maybe;
42
43
fn ();
43
44
// yes means completion_handler::operator() was called, so we're good.
44
45
if (*completed_immediately != completed_immediately_t ::yes)
45
- *completed_immediately = completed_immediately_t ::no ;
46
+ *completed_immediately = completed_immediately_t ::initiating ;
46
47
}
47
48
else
48
49
{
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ struct immediate_aw
44
44
&completed_immediately};
45
45
46
46
auto exec = asio::get_associated_immediate_executor (ch, h.promise ().get_executor ());
47
+ completed_immediately = async::detail::completed_immediately_t ::initiating;
47
48
asio::dispatch (exec, std::move (ch));
48
49
49
50
CHECK (result);
You can’t perform that action at this time.
0 commit comments