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:
parent
664117564a
commit
2693745336
6 changed files with 38 additions and 21 deletions
|
@ -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 {};
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue