aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/processing/scheduler.c
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2012-06-19 13:29:09 +0200
committerTobias Brunner <tobias@strongswan.org>2012-06-25 17:38:59 +0200
commit26d77eb3e61b2ff929dff96bbb53a5d22d76ce4f (patch)
tree5d5b7bd7bb2cd6a721c65b82f8ce2a8b3f4fdf22 /src/libstrongswan/processing/scheduler.c
parent7fec83af28f233a02b7ae08c6fd4de65799cb6b4 (diff)
downloadstrongswan-26d77eb3e61b2ff929dff96bbb53a5d22d76ce4f.tar.bz2
strongswan-26d77eb3e61b2ff929dff96bbb53a5d22d76ce4f.tar.xz
Centralized thread cancellation in processor_t
This ensures that no threads are active when plugins and the rest of the daemon are unloaded. callback_job_t was simplified a lot in the process as its main functionality is now contained in processor_t. The parent-child relationships were abandoned as these were only needed to simplify job cancellation.
Diffstat (limited to 'src/libstrongswan/processing/scheduler.c')
-rw-r--r--src/libstrongswan/processing/scheduler.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/libstrongswan/processing/scheduler.c b/src/libstrongswan/processing/scheduler.c
index 979a7139f..c97dbc4be 100644
--- a/src/libstrongswan/processing/scheduler.c
+++ b/src/libstrongswan/processing/scheduler.c
@@ -68,11 +68,6 @@ struct private_scheduler_t {
scheduler_t public;
/**
- * Job which queues scheduled jobs to the processor.
- */
- callback_job_t *job;
-
- /**
* The heap in which the events are stored.
*/
event_t **heap;
@@ -309,7 +304,6 @@ METHOD(scheduler_t, destroy, void,
private_scheduler_t *this)
{
event_t *event;
- this->job->cancel(this->job);
this->condvar->destroy(this->condvar);
this->mutex->destroy(this->mutex);
while ((event = remove_event(this)) != NULL)
@@ -326,6 +320,7 @@ METHOD(scheduler_t, destroy, void,
scheduler_t * scheduler_create()
{
private_scheduler_t *this;
+ callback_job_t *job;
INIT(this,
.public = {
@@ -342,9 +337,9 @@ scheduler_t * scheduler_create()
this->heap = (event_t**)calloc(this->heap_size + 1, sizeof(event_t*));
- this->job = callback_job_create_with_prio((callback_job_cb_t)schedule,
- this, NULL, NULL, JOB_PRIO_CRITICAL);
- lib->processor->queue_job(lib->processor, (job_t*)this->job);
+ job = callback_job_create_with_prio((callback_job_cb_t)schedule, this,
+ NULL, return_false, JOB_PRIO_CRITICAL);
+ lib->processor->queue_job(lib->processor, (job_t*)job);
return &this->public;
}