aboutsummaryrefslogtreecommitdiff
path: root/include/AsyncTask.hpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-04-02 00:21:03 +0200
committerdec05eba <dec05eba@protonmail.com>2021-04-02 00:21:03 +0200
commitc2934be8485376571066a652e94ed16ba2bc8d81 (patch)
tree381e69b5b2ebdb42313fab7fa6978fcb966d580c /include/AsyncTask.hpp
parentcfa37b674e9493388e7ebd89f53eacbb197cbdcb (diff)
Cancel all tasks when pressing escape to go to previous page or when closing the window
Diffstat (limited to 'include/AsyncTask.hpp')
-rw-r--r--include/AsyncTask.hpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/AsyncTask.hpp b/include/AsyncTask.hpp
index 0d9c453..abdc0f8 100644
--- a/include/AsyncTask.hpp
+++ b/include/AsyncTask.hpp
@@ -26,6 +26,19 @@ namespace QuickMedia {
return *this;
}
+ AsyncTask(AsyncTask &&other) {
+ cancel();
+ thread = std::move(other.thread);
+ future = std::move(other.future);
+ }
+
+ AsyncTask& operator=(AsyncTask &&other) {
+ cancel();
+ thread = std::move(other.thread);
+ future = std::move(other.future);
+ return *this;
+ }
+
~AsyncTask() {
cancel();
}