OpenDNSSEC-enforcer
2.0.2
|
#include "config.h"
#include <time.h>
#include <ldns/ldns.h>
#include <pthread.h>
#include "scheduler/task.h"
#include "status.h"
Go to the source code of this file.
Data Structures | |
struct | schedule_struct |
Typedefs | |
typedef struct schedule_struct | schedule_type |
Functions | |
schedule_type * | schedule_create (void) |
void | schedule_cleanup (schedule_type *schedule) |
void | schedule_flush (schedule_type *schedule) |
int | schedule_flush_type (schedule_type *schedule, task_id id) |
void | schedule_purge (schedule_type *schedule) |
ods_status | schedule_task (schedule_type *schedule, task_type *task) |
task_type * | schedule_pop_task (schedule_type *schedule) |
task_type * | schedule_pop_first_task (schedule_type *schedule) |
time_t | schedule_time_first (schedule_type *schedule) |
size_t | schedule_taskcount (schedule_type *schedule) |
void | schedule_print (FILE *out, schedule_type *schedule) |
void | schedule_release_all (schedule_type *schedule) |
typedef struct schedule_struct schedule_type |
Task scheduling. Task schedule.
Definition at line 47 of file schedule.h.
void schedule_cleanup | ( | schedule_type * | schedule | ) |
Clean up schedule.
[in] | schedule | schedule to be cleaned up |
Clean up schedule. deinitialise and free scheduler. Threads MUST be stopped before calling this function.
Definition at line 220 of file schedule.c.
References ods_log_debug().
Referenced by engine_dealloc().
schedule_type* schedule_create | ( | void | ) |
Create new schedule.
[in] | allocator | memory allocator |
Create new schedule. Allocate and initialise scheduler. To clean up schedule_cleanup() should be called.
Definition at line 189 of file schedule.c.
References ods_log_error().
Referenced by engine_alloc().
void schedule_flush | ( | schedule_type * | schedule | ) |
Flush schedule.
[in] | schedule | schedule to be flushed |
Definition at line 273 of file schedule.c.
References ods_log_debug().
int schedule_flush_type | ( | schedule_type * | schedule, |
task_id | id | ||
) |
Flush schedule for a specific type of task.
[in] | schedule | schedule to be flushed |
Definition at line 298 of file schedule.c.
References ods_log_debug().
Referenced by flush_resalt_task().
task_type* schedule_pop_first_task | ( | schedule_type * | schedule | ) |
Pop the first scheduled task. regardless of its due time.
[in] | schedule | schedule |
Definition at line 390 of file schedule.c.
References schedule_struct::schedule_lock.
task_type* schedule_pop_task | ( | schedule_type * | schedule | ) |
Pop the first scheduled task that is due. If an item is directly available it will be returned. Else the call will block and return NULL when the caller is awoken.
[in] | schedule | schedule |
Definition at line 370 of file schedule.c.
References schedule_struct::schedule_lock.
Referenced by worker_start().
void schedule_print | ( | FILE * | out, |
schedule_type * | schedule | ||
) |
Print schedule.
[in] | out | file descriptor |
[in] | schedule | schedule |
void schedule_purge | ( | schedule_type * | schedule | ) |
purge schedule. All tasks will be thrashed.
[in] | schedule | schedule to be purged |
Definition at line 342 of file schedule.c.
References schedule_struct::schedule_lock, task_cleanup(), schedule_struct::tasks, and schedule_struct::tasks_by_name.
void schedule_release_all | ( | schedule_type * | schedule | ) |
Wake up all threads waiting for tasks. Useful to on program teardown.
Definition at line 475 of file schedule.c.
References schedule_struct::schedule_cond, and schedule_struct::schedule_lock.
ods_status schedule_task | ( | schedule_type * | schedule, |
task_type * | task | ||
) |
Schedule task.
[in] | schedule | schedule |
[in] | task | task |
Task is already in tasks_by_name queue, so we must update it in tasks queue
Definition at line 401 of file schedule.c.
References ods_log_error().
Referenced by flush_resalt_task().
size_t schedule_taskcount | ( | schedule_type * | schedule | ) |
Number of task in schedule
[in] | schedule | schedule |
Definition at line 266 of file schedule.c.
References schedule_struct::tasks.
time_t schedule_time_first | ( | schedule_type * | schedule | ) |
Time of first task in schedule.
[in] | schedule | schedule |
exported convenience functions should all be thread safe
Definition at line 246 of file schedule.c.
References schedule_struct::schedule_lock, and schedule_struct::tasks.