Skip to content

Commit 50adc32

Browse files
committed
switch Then temp Future to use monostate
1 parent dec560f commit 50adc32

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

libs/internal/include/launchdarkly/async/promise.hpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ class PromiseInternal {
133133
// Call continuations outside the lock so that continuations which
134134
// re-enter this future (e.g. via GetResult or Then) don't deadlock.
135135
for (auto& continuation : to_call) {
136+
// It's safe to access result_ outside the lock here, because it
137+
// can't be changed again.
136138
continuation(*result_);
137139
}
138140

@@ -355,10 +357,10 @@ class Future {
355357
};
356358
auto state = std::make_shared<State>();
357359

358-
// The continuation ignores T entirely (returning a dummy int). The
359-
// executor signals the cv when called, since being called means the
360-
// original future has resolved.
361-
Then([](T const&) { return 0; },
360+
// The continuation ignores T entirely. The executor signals the cv
361+
// when called, since being called means the original future has
362+
// resolved.
363+
Then([](T const&) { return std::monostate{}; },
362364
[state](Continuation<void()> work) {
363365
{
364366
std::lock_guard<std::mutex> lock(state->mutex);

0 commit comments

Comments
 (0)