int add_a_job(int taskid, task_handler task, int expires) { int ret; reset_current_timers(); ret = append_a_job(taskid, task, expires); if (-1 == ret) { fprintf(stderr, "Timer queue was full!\n"); return -1; } sort_jobs(); timers_reboot(); return 0; }
/* * Take a list of jobs, break it into sublists, return a pointer to a * new list of jobs in the order in which they should be run. */ Job * schd_sort_jobs(Job *jobs) { Job *newjobs = NULL; if (split_jobs(jobs)) return (NULL); /* Sort jobs based on local policy requirements */ sort_jobs(); /* Create the current 'schedule' of running jobs */ create_job_schedule(); /* Convert arrays of jobs into a linked list. */ newjobs = make_job_list(); return (newjobs); }
/* * Take a list of jobs, break it into sublists, return a pointer to a * new list of jobs in the order in which they should be run. */ Job * schd_sort_jobs(Job *jobs) { Job *newjobs = NULL; if (split_jobs(jobs)) return (NULL); /* Create the list of all users with queued and running jobs */ get_users(); /* Assign jobs a priority value based on their originating queue */ set_priorities(); /* Sort jobs in normalQ. */ sort_jobs(); /* Convert arrays of jobs into a linked list. */ newjobs = make_job_list(); return (newjobs); }