mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:57:44 +00:00
LibThreading: Add ability to cancel ongoing BackgroundActions
Handlers of the BackgroundAction are responsible for checking if the action has been cancelled and returning early.
This commit is contained in:
parent
4a3958c8ae
commit
00f93b2545
4 changed files with 18 additions and 7 deletions
|
@ -689,7 +689,7 @@ bool Compositor::set_wallpaper_mode(const String& mode)
|
|||
bool Compositor::set_wallpaper(const String& path, Function<void(bool)>&& callback)
|
||||
{
|
||||
Threading::BackgroundAction<RefPtr<Gfx::Bitmap>>::create(
|
||||
[path] {
|
||||
[path](auto&) {
|
||||
return Gfx::Bitmap::load_from_file(path);
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue