]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
If a task is running and we call isc_task_pause it can
authorWitold Kręcicki <wpk@isc.org>
Wed, 13 Nov 2019 10:26:34 +0000 (11:26 +0100)
committerWitold Krecicki <wpk@isc.org>
Wed, 13 Nov 2019 12:32:17 +0000 (12:32 +0000)
be implicitly unpaused when we switch from 'running' to
'idle' state. Fix it by not switching to 'idle' when paused.

lib/isc/task.c

index 81009538c03babf153ad81bb7fb145c1d5b826e3..19449aacf77d9feac1e4a8a9a246bf3f5768a911 100644 (file)
@@ -1190,7 +1190,11 @@ dispatch(isc__taskmgr_t *manager, unsigned int threadid) {
                                                finished = true;
                                                task->state = task_state_done;
                                        } else {
-                                               task->state = task_state_idle;
+                                               /* It might be paused */
+                                               if (task->state ==
+                                                   task_state_running) {
+                                                       task->state = task_state_idle;
+                                               }
                                        }
                                        done = true;
                                } else if (dispatch_count >= task->quantum) {
@@ -1205,8 +1209,14 @@ dispatch(isc__taskmgr_t *manager, unsigned int threadid) {
                                         * so the minimum quantum is one.
                                         */
                                        XTRACE("quantum");
-                                       task->state = task_state_ready;
-                                       requeue = true;
+                                       if (task->state == task_state_running) {
+                                               /*
+                                                * We requeue only if it's
+                                                * not paused.
+                                                */
+                                               task->state = task_state_ready;
+                                               requeue = true;
+                                       }
                                        done = true;
                                }
                        } while (!done);