- return value cleanup

This commit is contained in:
Martin Willi
2005-11-28 20:29:47 +00:00
parent 3fe058703f
commit d048df5cab
85 changed files with 1086 additions and 2680 deletions
+13 -21
View File
@@ -43,7 +43,6 @@ struct private_scheduler_t {
*/
scheduler_t public;
/**
* @brief Get events from the event queue and add them to to job queue.
*
@@ -53,16 +52,15 @@ struct private_scheduler_t {
*/
void (*get_events) (private_scheduler_t *this);
/**
* Assigned thread to the scheduler_t object
*/
pthread_t assigned_thread;
/**
* logger for this scheduler
*/
logger_t *logger;
/**
* Assigned thread to the scheduler_t object
*/
pthread_t assigned_thread;
/**
* logger for this scheduler
*/
logger_t *logger;
};
/**
@@ -81,7 +79,7 @@ static void get_events(private_scheduler_t * this)
{
this->logger->log(this->logger, CONTROL|MORE, "waiting for next event...");
/* get a job, this block until one is available */
global_event_queue->get(global_event_queue, &current_job);
current_job = global_event_queue->get(global_event_queue);
/* queue the job in the job queue, workers will eat them */
global_job_queue->add(global_job_queue, current_job);
this->logger->log(this->logger, CONTROL, "got event, added job %s to job-queue.",
@@ -92,7 +90,7 @@ static void get_events(private_scheduler_t * this)
/**
* Implementation of scheduler_t's destroy function
*/
static status_t destroy(private_scheduler_t *this)
static void destroy(private_scheduler_t *this)
{
this->logger->log(this->logger, CONTROL | MORE, "Going to terminate scheduler thread");
pthread_cancel(this->assigned_thread);
@@ -103,7 +101,6 @@ static status_t destroy(private_scheduler_t *this)
global_logger_manager->destroy_logger(global_logger_manager, this->logger);
allocator_free(this);
return SUCCESS;
}
@@ -111,20 +108,15 @@ scheduler_t * scheduler_create()
{
private_scheduler_t *this = allocator_alloc_thing(private_scheduler_t);
this->public.destroy = (status_t(*)(scheduler_t*)) destroy;
this->public.destroy = (void(*)(scheduler_t*)) destroy;
this->get_events = get_events;
this->logger = global_logger_manager->create_logger(global_logger_manager, SCHEDULER, NULL);
if (this->logger == NULL)
{
allocator_free(this);
return NULL;
}
if (pthread_create(&(this->assigned_thread), NULL, (void*(*)(void*))this->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!");
global_logger_manager->destroy_logger(global_logger_manager, this->logger);
allocator_free(this);
return NULL;