diff options
author | Martin Willi <martin@strongswan.org> | 2007-11-14 10:12:34 +0000 |
---|---|---|
committer | Martin Willi <martin@strongswan.org> | 2007-11-14 10:12:34 +0000 |
commit | 93fc29c6cf391f51d13ded4b760ac85f5d60f13b (patch) | |
tree | eec8535d297818b21a0b0ba7534154e274090306 /src/charon/processing/jobs/callback_job.c | |
parent | 91b16af0fabd8e7b8ef7d732706885eef5a5815f (diff) | |
download | strongswan-93fc29c6cf391f51d13ded4b760ac85f5d60f13b.tar.bz2 strongswan-93fc29c6cf391f51d13ded4b760ac85f5d60f13b.tar.xz |
fixed daemon kill before threads are spawned
Diffstat (limited to 'src/charon/processing/jobs/callback_job.c')
-rw-r--r-- | src/charon/processing/jobs/callback_job.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/charon/processing/jobs/callback_job.c b/src/charon/processing/jobs/callback_job.c index 6f534e0f7..2cba60629 100644 --- a/src/charon/processing/jobs/callback_job.c +++ b/src/charon/processing/jobs/callback_job.c @@ -121,12 +121,7 @@ static void cancel(private_callback_job_t *this) { pthread_t thread; - /* wait until thread has started */ pthread_mutex_lock(&this->mutex); - while (this->thread == 0) - { - pthread_cond_wait(&this->condvar, &this->mutex); - } thread = this->thread; /* terminate its children */ @@ -134,8 +129,11 @@ static void cancel(private_callback_job_t *this) pthread_mutex_unlock(&this->mutex); /* terminate thread */ - pthread_cancel(thread); - pthread_join(thread, NULL); + if (thread) + { + pthread_cancel(thread); + pthread_join(thread, NULL); + } } /** |