diff options
author | Tobias Brunner <tobias@strongswan.org> | 2008-04-02 15:28:08 +0000 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2008-04-02 15:28:08 +0000 |
commit | f049b29491641e6af463b616e9081f2b3c68f628 (patch) | |
tree | 38e6f248501ac913068c70a6e2e682626fe7702d /src/charon/processing/processor.c | |
parent | 1ee637d8b162cdcabc42a57968d3332a726b56b1 (diff) | |
download | strongswan-f049b29491641e6af463b616e9081f2b3c68f628.tar.bz2 strongswan-f049b29491641e6af463b616e9081f2b3c68f628.tar.xz |
securing total_threads with the mutex while destroying the processor
Diffstat (limited to 'src/charon/processing/processor.c')
-rw-r--r-- | src/charon/processing/processor.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/charon/processing/processor.c b/src/charon/processing/processor.c index bfae7bdff..e14679b14 100644 --- a/src/charon/processing/processor.c +++ b/src/charon/processing/processor.c @@ -193,11 +193,13 @@ static void set_threads(private_processor_t *this, u_int count) static void destroy(private_processor_t *this) { set_threads(this, 0); + pthread_mutex_lock(&this->mutex); while (this->total_threads > 0) { pthread_cond_broadcast(&this->condvar); pthread_cond_wait(&this->condvar, &this->mutex); } + pthread_mutex_unlock(&this->mutex); this->list->destroy_offset(this->list, offsetof(job_t, destroy)); free(this); } |