processor: force synchronous execute_job() if set_threads(0) has been called
authorMartin Willi <martin@revosec.ch>
Fri, 19 Jul 2013 13:27:07 +0000 (15:27 +0200)
committerMartin Willi <martin@revosec.ch>
Fri, 19 Jul 2013 13:30:22 +0000 (15:30 +0200)
During daemon shutdown, some idle threads might be lingering around even if
set_threads(0) already has been called. To avoid any races, we enforce
synchronous execution of the job.

src/libstrongswan/processing/processor.c

index e00216e..adbd956 100644 (file)
@@ -408,7 +408,7 @@ METHOD(processor_t, execute_job, void,
        bool queued = FALSE;
 
        this->mutex->lock(this->mutex);
-       if (get_idle_threads_nolock(this))
+       if (this->desired_threads && get_idle_threads_nolock(this))
        {
                prio = sane_prio(job->get_priority(job));
                job->status = JOB_STATUS_QUEUED;