OpenDNSSEC-signer
1.3.15
|
#include "scheduler/task.h"
#include "shared/allocator.h"
#include "shared/locks.h"
#include <time.h>
Go to the source code of this file.
Data Structures | |
struct | worker_struct |
Typedefs | |
typedef enum worker_enum | worker_id |
typedef struct worker_struct | worker_type |
Enumerations | |
enum | worker_enum { WORKER_NONE = 0, WORKER_WORKER = 1, WORKER_DRUDGER } |
Functions | |
worker_type * | worker_create (allocator_type *allocator, int num, worker_id type) |
void | worker_start (worker_type *worker) |
void | worker_sleep (worker_type *worker, time_t timeout) |
void | worker_sleep_unless (worker_type *worker, time_t timeout) |
void | worker_wakeup (worker_type *worker) |
void | worker_wait (lock_basic_type *lock, cond_basic_type *condition) |
void | worker_wait_locked (lock_basic_type *lock, cond_basic_type *condition) |
void | worker_wait_timeout (lock_basic_type *lock, cond_basic_type *condition, time_t timeout) |
void | worker_wait_timeout_locked (lock_basic_type *lock, cond_basic_type *condition, time_t timeout) |
void | worker_notify (lock_basic_type *lock, cond_basic_type *condition) |
void | worker_notify_all (lock_basic_type *lock, cond_basic_type *condition) |
void | worker_cleanup (worker_type *worker) |
typedef enum worker_enum worker_id |
typedef struct worker_struct worker_type |
enum worker_enum |
void worker_cleanup | ( | worker_type * | worker) |
Clean up worker.
[in] | worker | worker to clean up |
Clean up worker.
Definition at line 892 of file worker.c.
References worker_struct::allocator, engine_struct::allocator, allocator_deallocate(), lock_basic_destroy, lock_basic_off, worker_struct::worker_alarm, and worker_struct::worker_lock.
Referenced by engine_cleanup().
worker_type* worker_create | ( | allocator_type * | allocator, |
int | num, | ||
worker_id | type | ||
) |
Create worker.
[in] | allocator | memory allocator |
[in] | num | thread number |
[in] | type | type of worker |
Create worker.
Definition at line 63 of file worker.c.
References worker_struct::allocator, engine_struct::allocator, allocator_alloc(), worker_struct::clock_in, worker_struct::engine, worker_struct::jobs_appointed, worker_struct::jobs_completed, worker_struct::jobs_failed, lock_basic_init, lock_basic_lock, lock_basic_set, lock_basic_unlock, LOCKED_WORKER_INIT, worker_struct::need_to_exit, ods_log_assert, ods_log_debug(), worker_struct::sleeping, worker_struct::task, TASK_NONE, worker_struct::thread_num, worker_struct::type, worker_struct::waiting, worker_struct::worker_alarm, worker_struct::worker_lock, worker_struct::worker_locked, and worker_struct::working_with.
void worker_notify | ( | lock_basic_type * | lock, |
cond_basic_type * | condition | ||
) |
Notify a worker.
[in] | lock | lock to use |
[in] | condition | condition that has been met |
Notify a worker.
Definition at line 864 of file worker.c.
References lock_basic_alarm, lock_basic_lock, and lock_basic_unlock.
void worker_notify_all | ( | lock_basic_type * | lock, |
cond_basic_type * | condition | ||
) |
Notify all workers.
[in] | lock | lock to use |
[in] | condition | condition that has been met |
Notify all workers.
Definition at line 878 of file worker.c.
References lock_basic_broadcast, lock_basic_lock, and lock_basic_unlock.
Referenced by engine_stop_drudgers().
void worker_sleep | ( | worker_type * | worker, |
time_t | timeout | ||
) |
Put worker to sleep.
[in] | worker | put this worker to sleep |
[in] | timeout | time before alarm clock is going off, 0 means no alarm clock is set. |
Put worker to sleep.
Definition at line 745 of file worker.c.
References lock_basic_lock, lock_basic_sleep, lock_basic_unlock, LOCKED_WORKER_SLEEP, ods_log_assert, worker_struct::sleeping, worker_struct::worker_alarm, worker_struct::worker_lock, and worker_struct::worker_locked.
void worker_sleep_unless | ( | worker_type * | worker, |
time_t | timeout | ||
) |
Put worker to sleep unless the worker has measured up to all appointed jobs.
[in] | worker | put this worker to sleep |
[in] | timeout | time before alarm clock is going off, 0 means no alarm clock is set. |
Put worker to sleep unless worker has measured up to all appointed jobs.
Definition at line 764 of file worker.c.
References worker_struct::jobs_appointed, worker_struct::jobs_completed, worker_struct::jobs_failed, lock_basic_lock, lock_basic_sleep, lock_basic_unlock, LOCKED_WORKER_SLEEP_UNLESS, worker_struct::need_to_exit, ods_log_assert, ods_log_debug(), worker_struct::sleeping, worker_struct::thread_num, worker_struct::type, worker_struct::worker_alarm, worker_struct::worker_lock, and worker_struct::worker_locked.
void worker_start | ( | worker_type * | worker) |
Start working.
[in] | worker | worker to start working |
Start worker.
Definition at line 722 of file worker.c.
References ods_log_assert, ods_log_error(), worker_struct::type, WORKER_DRUDGER, and WORKER_WORKER.
void worker_wait | ( | lock_basic_type * | lock, |
cond_basic_type * | condition | ||
) |
Let worker wait.
[in] | lock | lock to use |
[in] | condition | condition to be met |
Worker waiting.
Definition at line 840 of file worker.c.
References worker_wait_timeout().
void worker_wait_locked | ( | lock_basic_type * | lock, |
cond_basic_type * | condition | ||
) |
Let worker wait on an already locked cond.
[in] | lock | lock to use |
[in] | condition | condition to be met |
Worker waiting on an already locked cond.
Definition at line 852 of file worker.c.
References worker_wait_timeout_locked().
void worker_wait_timeout | ( | lock_basic_type * | lock, |
cond_basic_type * | condition, | ||
time_t | timeout | ||
) |
Let worker wait.
[in] | lock | lock to use |
[in] | condition | condition to be met |
[in] | timeout | maximum waiting time in seconds |
Worker waiting.
Definition at line 812 of file worker.c.
References lock_basic_lock, lock_basic_sleep, and lock_basic_unlock.
Referenced by worker_wait().
void worker_wait_timeout_locked | ( | lock_basic_type * | lock, |
cond_basic_type * | condition, | ||
time_t | timeout | ||
) |
Let worker wait on an already locked cond.
[in] | lock | lock to use |
[in] | condition | condition to be met |
[in] | timeout | maximum waiting time in seconds |
Worker waiting on an already locked cond
Definition at line 827 of file worker.c.
References lock_basic_sleep.
Referenced by worker_wait_locked().
void worker_wakeup | ( | worker_type * | worker) |
Wake up worker.
[in] | worker | wake up this worker |
Wake up worker.
Definition at line 790 of file worker.c.
References lock_basic_alarm, lock_basic_lock, lock_basic_unlock, LOCKED_WORKER_WAKEUP, ods_log_assert, ods_log_debug(), worker_struct::sleeping, worker_struct::thread_num, worker_struct::type, worker_struct::worker_alarm, worker_struct::worker_lock, and worker_struct::worker_locked.
Referenced by engine_wakeup_workers().