summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
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);
}