fixed a at-least-one-year-old bug which caused crashed in the scheduler
This commit is contained in:
@@ -68,13 +68,13 @@ static void get_events(private_scheduler_t * this)
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
this->logger->log(this->logger, CONTROL|LEVEL2, "Waiting for next event...");
|
||||
this->logger->log(this->logger, CONTROL|LEVEL2, "waiting for next event...");
|
||||
/* get a job, this block until one is available */
|
||||
current_job = charon->event_queue->get(charon->event_queue);
|
||||
/* queue the job in the job queue, workers will eat them */
|
||||
charon->job_queue->add(charon->job_queue, current_job);
|
||||
this->logger->log(this->logger, CONTROL | LEVEL1, "Got event, added job %s to job-queue.",
|
||||
this->logger->log(this->logger, CONTROL | LEVEL1, "got event, adding job %s to job-queue.",
|
||||
mapping_find(job_type_m, current_job->get_type(current_job)));
|
||||
charon->job_queue->add(charon->job_queue, current_job);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,11 +83,11 @@ static void get_events(private_scheduler_t * this)
|
||||
*/
|
||||
static void destroy(private_scheduler_t *this)
|
||||
{
|
||||
this->logger->log(this->logger, CONTROL | LEVEL1, "Going to terminate scheduler thread");
|
||||
this->logger->log(this->logger, CONTROL | LEVEL1, "going to terminate scheduler thread");
|
||||
pthread_cancel(this->assigned_thread);
|
||||
|
||||
pthread_join(this->assigned_thread, NULL);
|
||||
this->logger->log(this->logger, CONTROL | LEVEL1, "Scheduler thread terminated");
|
||||
this->logger->log(this->logger, CONTROL | LEVEL1, "scheduler thread terminated");
|
||||
|
||||
free(this);
|
||||
}
|
||||
@@ -106,9 +106,9 @@ scheduler_t * scheduler_create()
|
||||
if (pthread_create(&(this->assigned_thread), NULL, (void*(*)(void*))get_events, this) != 0)
|
||||
{
|
||||
/* thread could not be created */
|
||||
this->logger->log(this->logger, ERROR, "Scheduler thread could not be created!");
|
||||
this->logger->log(this->logger, ERROR, "scheduler thread could not be created!");
|
||||
free(this);
|
||||
charon->kill(charon, "Unable to create scheduler thread");
|
||||
charon->kill(charon, "unable to create scheduler thread");
|
||||
}
|
||||
|
||||
return &(this->public);
|
||||
|
||||
Reference in New Issue
Block a user