diff options
author | Martin Willi <martin@strongswan.org> | 2006-07-10 14:24:04 +0000 |
---|---|---|
committer | Martin Willi <martin@strongswan.org> | 2006-07-10 14:24:04 +0000 |
commit | abba7ecb9d454d2cf0b51b17c3442132435b05b0 (patch) | |
tree | 5dc0667752f515620a2b6e6a2c61b87a35dddb0f /src/charon/queues/job_queue.c | |
parent | c5d2d7c0230569c7995c34d538abd03c737b9281 (diff) | |
download | strongswan-abba7ecb9d454d2cf0b51b17c3442132435b05b0.tar.bz2 strongswan-abba7ecb9d454d2cf0b51b17c3442132435b05b0.tar.xz |
further work done for simultaneous rekeying/delete
still some cases which cause trouble
Diffstat (limited to 'src/charon/queues/job_queue.c')
-rw-r--r-- | src/charon/queues/job_queue.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/charon/queues/job_queue.c b/src/charon/queues/job_queue.c index c1df42136..d33cd5ae4 100644 --- a/src/charon/queues/job_queue.c +++ b/src/charon/queues/job_queue.c @@ -86,14 +86,14 @@ static job_t *get(private_job_queue_t *this) /* add mutex unlock handler for cancellation, enable cancellation */ pthread_cleanup_push((void(*)(void*))pthread_mutex_unlock, (void*)&(this->mutex)); pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &oldstate); - + pthread_cond_wait( &(this->condvar), &(this->mutex)); - + /* reset cancellation, remove mutex-unlock handler (without executing) */ pthread_setcancelstate(oldstate, NULL); pthread_cleanup_pop(0); } - this->list->remove_first(this->list,(void **) &job); + this->list->remove_first(this->list, (void **)&job); pthread_mutex_unlock(&(this->mutex)); return job; } @@ -114,22 +114,14 @@ static void add(private_job_queue_t *this, job_t *job) */ static void job_queue_destroy (private_job_queue_t *this) { - while (this->list->get_count(this->list) > 0) + job_t *job; + while (this->list->remove_last(this->list, (void**)&job) == SUCCESS) { - job_t *job; - if (this->list->remove_first(this->list,(void *) &job) != SUCCESS) - { - this->list->destroy(this->list); - break; - } job->destroy(job); } this->list->destroy(this->list); - pthread_mutex_destroy(&(this->mutex)); - pthread_cond_destroy(&(this->condvar)); - free(this); } |