1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:18:12 +00:00

LibThreading+Everywhere: Support returning error from BackgroundAction

This patch allows returning an `Error` from the `on_complete` callback
in `BackgroundAction`.

It also adds a custom callback to manage errors returned during its
execution.
This commit is contained in:
Lucas CHOLLET 2022-12-12 23:34:28 +01:00 committed by Linus Groh
parent 664117564a
commit 2693745336
6 changed files with 38 additions and 21 deletions

View file

@ -120,10 +120,11 @@ void ThreadStackWidget::refresh()
return Symbolication::symbolicate_thread(pid, tid, Symbolication::IncludeSourcePosition::No);
},
[weak_this = make_weak_ptr()](auto result) {
[weak_this = make_weak_ptr()](auto result) -> ErrorOr<void> {
if (!weak_this)
return;
return {};
Core::EventLoop::current().post_event(const_cast<Core::Object&>(*weak_this), make<CompletionEvent>(move(result)));
return {};
});
}