aboutsummaryrefslogtreecommitdiffstats
path: root/src/charon/processing/scheduler.c
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2007-11-19 12:32:28 +0000
committerMartin Willi <martin@strongswan.org>2007-11-19 12:32:28 +0000
commit7b36b734a4db879802c48b640db176d03add01e6 (patch)
tree5bc1693a4bf05d994b04f3e63a4f06ec36b6021a /src/charon/processing/scheduler.c
parente533b928f0d238bcaf71d11de1a1680cc576d913 (diff)
downloadstrongswan-7b36b734a4db879802c48b640db176d03add01e6.tar.bz2
strongswan-7b36b734a4db879802c48b640db176d03add01e6.tar.xz
fixed callback_job cancellation for threads waiting in the bus
Diffstat (limited to 'src/charon/processing/scheduler.c')
-rw-r--r--src/charon/processing/scheduler.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/charon/processing/scheduler.c b/src/charon/processing/scheduler.c
index 2706585b0..ededb479a 100644
--- a/src/charon/processing/scheduler.c
+++ b/src/charon/processing/scheduler.c
@@ -87,6 +87,8 @@ struct private_scheduler_t {
* Condvar to wait for next job.
*/
pthread_cond_t condvar;
+
+ bool cancelled;
};
/**
@@ -148,9 +150,7 @@ static job_requeue_t schedule(private_scheduler_t * this)
pthread_cond_wait(&this->condvar, &this->mutex);
}
pthread_setcancelstate(oldstate, NULL);
- pthread_cleanup_pop(0);
-
- pthread_mutex_unlock(&this->mutex);
+ pthread_cleanup_pop(TRUE);
return JOB_REQUEUE_DIRECT;
}
@@ -234,6 +234,7 @@ static void schedule_job(private_scheduler_t *this, job_t *job, u_int32_t time)
*/
static void destroy(private_scheduler_t *this)
{
+ this->cancelled = TRUE;
this->job->cancel(this->job);
this->list->destroy_function(this->list, (void*)event_destroy);
free(this);
@@ -251,6 +252,7 @@ scheduler_t * scheduler_create()
this->public.destroy = (void(*)(scheduler_t*)) destroy;
this->list = linked_list_create();
+ this->cancelled = FALSE;
pthread_mutex_init(&this->mutex, NULL);
pthread_cond_init(&this->condvar, NULL);