do not respawn cancelled threads if we are shutting down
authorMartin Willi <martin@strongswan.org>
Fri, 12 Dec 2008 15:57:12 +0000 (15:57 -0000)
committerMartin Willi <martin@strongswan.org>
Fri, 12 Dec 2008 15:57:12 +0000 (15:57 -0000)
src/charon/processing/processor.c

index a5f1833..156c65b 100644 (file)
@@ -84,7 +84,9 @@ static void restart(private_processor_t *this)
 {
        pthread_t thread;
        
-       if (pthread_create(&thread, NULL, (void*)process_jobs, this) != 0)
+       /* respawn thread if required */
+       if (this->desired_threads == 0 ||
+               pthread_create(&thread, NULL, (void*)process_jobs, this) != 0)
        {
                this->mutex->lock(this->mutex);
                this->total_threads--;