enhance Future::Then()
This commit is contained in:
@@ -163,11 +163,11 @@ class Node::Lambda final : public nf7::Node::Lambda,
|
||||
f_->factory_ = b.Build();
|
||||
b.Send("create", nf7::Value::Pulse {});
|
||||
|
||||
f_->fu_->ThenSub(self, [this](auto) { if (f_) f_->factory_ = nullptr; });
|
||||
f_->fu_->Then(self, [this](auto) { if (f_) f_->factory_ = nullptr; });
|
||||
}
|
||||
|
||||
assert(f_->fu_);
|
||||
f_->fu_->ThenSub(self, [this, k = std::string {k}, v = v, caller](auto fu) mutable {
|
||||
f_->fu_->Then(self, [this, k = std::string {k}, v = v, caller](auto fu) mutable {
|
||||
try {
|
||||
auto ref = fu.value().template data<nf7::luajit::Ref>();
|
||||
CallFunc(ref, std::move(k), std::move(v), caller);
|
||||
|
@@ -256,8 +256,7 @@ class NFile::Lambda final : public nf7::Node::Lambda,
|
||||
lock_ = f_->mtx_.AcquireLock(ex);
|
||||
}
|
||||
auto self = shared_from_this();
|
||||
lock_->Then([self, this, caller, f = std::move(f)](auto fu) mutable {
|
||||
const auto k = fu.value();
|
||||
lock_->ThenIf([self, this, caller, f = std::move(f)](auto&) mutable {
|
||||
f_->th_->Push(self, NFile::Runner::Task {
|
||||
.callee = self,
|
||||
.caller = std::move(caller),
|
||||
|
Reference in New Issue
Block a user