summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-08-06 22:57:58 +0200
committerCarl Hetherington <cth@carlh.net>2022-08-11 22:40:59 +0200
commit1fe717e9125e896c92f281922e87f8158b15c7af (patch)
treefff3bdf299150f6339428b60ac30b0a6bcf3531c /src/lib
parent1d3085c403f265fb203654d461c0b77974205f2f (diff)
Allow cancellation of un-started jobs (#2777).
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/job.cc14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/lib/job.cc b/src/lib/job.cc
index 5bed3f0d2..8f0a7474f 100644
--- a/src/lib/job.cc
+++ b/src/lib/job.cc
@@ -589,17 +589,15 @@ Job::remaining_time () const
void
Job::cancel ()
{
- if (!_thread.joinable()) {
- return;
- }
+ if (_thread.joinable()) {
+ if (paused_by_user() || paused_by_priority()) {
+ resume ();
+ }
- if (paused_by_user() || paused_by_priority()) {
- resume ();
+ _thread.interrupt ();
+ _thread.join ();
}
- _thread.interrupt ();
- _thread.join ();
-
set_state (FINISHED_CANCELLED);
}