OpenDNSSEC-signer  2.0.3
Data Structures | Typedefs | Enumerations | Functions
worker.h File Reference
#include "config.h"
#include <time.h>
#include "scheduler/task.h"
#include "status.h"
#include "locks.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_typeworker_create (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_notify_all (lock_basic_type *lock, cond_basic_type *condition)
 
void worker_cleanup (worker_type *worker)
 

Typedef Documentation

◆ worker_id

typedef enum worker_enum worker_id

Definition at line 43 of file worker.h.

◆ worker_type

typedef struct worker_struct worker_type

Definition at line 45 of file worker.h.

Enumeration Type Documentation

◆ worker_enum

The hard workers.

Enumerator
WORKER_NONE 
WORKER_WORKER 
WORKER_DRUDGER 

Definition at line 38 of file worker.h.

Function Documentation

◆ worker_cleanup()

void worker_cleanup ( worker_type worker)

Clean up worker.

Parameters
[in]workerworker to clean up

Clean up worker.

Definition at line 837 of file worker.c.

References worker_struct::worker_alarm, and worker_struct::worker_lock.

Referenced by engine_cleanup().

◆ worker_create()

worker_type* worker_create ( int  num,
worker_id  type 
)

Create worker.

Parameters
[in]allocatormemory allocator
[in]numthread number
[in]typetype of worker
Returns
worker_type* created worker

Create worker.

Definition at line 65 of file worker.c.

◆ worker_notify_all()

void worker_notify_all ( lock_basic_type *  lock,
cond_basic_type *  condition 
)

Notify all workers.

Parameters
[in]locklock to use
[in]conditioncondition that has been met

Notify all workers.

Definition at line 824 of file worker.c.

◆ worker_sleep()

void worker_sleep ( worker_type worker,
time_t  timeout 
)

Put worker to sleep.

Parameters
[in]workerput this worker to sleep
[in]timeouttime before alarm clock is going off, 0 means no alarm clock is set.

Put worker to sleep.

Definition at line 765 of file worker.c.

References worker_struct::need_to_exit, worker_struct::sleeping, worker_struct::worker_alarm, and worker_struct::worker_lock.

◆ worker_sleep_unless()

void worker_sleep_unless ( worker_type worker,
time_t  timeout 
)

Put worker to sleep unless the worker has measured up to all appointed jobs.

Parameters
[in]workerput this worker to sleep
[in]timeouttime 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 783 of file worker.c.

References worker_struct::need_to_exit, and worker_struct::worker_lock.

◆ worker_start()

void worker_start ( worker_type worker)

Start working.

Parameters
[in]workerworker to start working

Start worker.

Definition at line 743 of file worker.c.

References worker_struct::type, and WORKER_DRUDGER.

◆ worker_wakeup()

void worker_wakeup ( worker_type worker)

Wake up worker.

Parameters
[in]workerwake up this worker

Wake up worker.

Definition at line 805 of file worker.c.

References worker_struct::sleeping, and worker_struct::waiting.