improve nf7::Mutex

This commit is contained in:
2022-10-09 17:58:28 +09:00
parent 2edd7d9e88
commit 77dc8cef32
2 changed files with 91 additions and 39 deletions

View File

@@ -252,10 +252,10 @@ class NFile::Lambda final : public nf7::Node::Lambda,
void Push(const std::shared_ptr<nf7::Node::Lambda>& caller, bool ex, auto&& f) noexcept {
if (!lock_) {
lock_ = f_->mtx_.AcquireLock(ex);
}
auto self = shared_from_this();
if (!lock_) {
lock_ = f_->mtx_.AcquireLock(self, ex);
}
lock_->ThenIf([self, this, caller, f = std::move(f)](auto&) mutable {
f_->th_->Push(self, NFile::Runner::Task {
.callee = self,