mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-07 22:02:12 +08:00
conversation: callback without lock
Change-Id: I01574e819210c853c8cdbcde6f366956b61b8077
This commit is contained in:
@ -1717,8 +1717,10 @@ Conversation::loadMessages2(const OnLoadMessages2& cb, const LogOptions& options
|
||||
return;
|
||||
dht::ThreadPool::io().run([w = weak(), cb = std::move(cb), options] {
|
||||
if (auto sthis = w.lock()) {
|
||||
std::lock_guard lk(sthis->pimpl_->loadedHistory_.mutex);
|
||||
cb(sthis->pimpl_->loadMessages2(options));
|
||||
std::unique_lock lk(sthis->pimpl_->loadedHistory_.mutex);
|
||||
auto result = sthis->pimpl_->loadMessages2(options);
|
||||
lk.unlock();
|
||||
cb(std::move(result));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user