OpenDNSSEC-signer  1.4.9
Macros | Typedefs | Functions
locks.h File Reference
#include "config.h"
#include "shared/log.h"
#include <errno.h>
#include <stdlib.h>
Include dependency graph for locks.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define LOCKRET(func)
 
#define PTHREADS_DISABLED   1
 
#define lock_basic_init(lock)   /* nop */
 
#define lock_basic_destroy(lock)   /* nop */
 
#define lock_basic_lock(lock)   /* nop */
 
#define lock_basic_unlock(lock)   /* nop */
 
#define lock_basic_set(cond)   /* nop */
 
#define lock_basic_sleep(cond, lock, sleep)   /* nop */
 
#define lock_basic_alarm(cond)   /* nop */
 
#define lock_basic_broadcast(cond)   /* nop */
 
#define lock_basic_off(cond)   /* nop */
 
#define ods_thread_create(thr, func, arg)   ods_thr_fork_create(thr, func, arg)
 
#define ods_thread_detach(thr)   /* nop */
 
#define ods_thread_self()   getpid()
 
#define ods_thread_join(thr)   ods_thr_fork_wait(thr)
 

Typedefs

typedef int lock_basic_type
 
typedef pid_t ods_thread_type
 

Functions

void ods_thr_fork_create (ods_thread_type *thr, void *(*func)(void *), void *arg)
 
void ods_thr_fork_wait (ods_thread_type thread)
 
void ods_thread_blocksigs (void)
 

Macro Definition Documentation

#define lock_basic_alarm (   cond)    /* nop */

Definition at line 99 of file locks.h.

Referenced by signal_handler(), worker_create(), worker_notify(), and worker_wakeup().

#define lock_basic_broadcast (   cond)    /* nop */

Definition at line 100 of file locks.h.

Referenced by fifoq_pop(), fifoq_push(), and worker_notify_all().

#define lock_basic_destroy (   lock)    /* nop */
#define lock_basic_init (   lock)    /* nop */
#define lock_basic_lock (   lock)    /* nop */
#define lock_basic_off (   cond)    /* nop */

Definition at line 101 of file locks.h.

Referenced by engine_cleanup(), fifoq_cleanup(), and worker_cleanup().

#define lock_basic_set (   cond)    /* nop */

Definition at line 97 of file locks.h.

Referenced by fifoq_create(), and worker_create().

#define lock_basic_sleep (   cond,
  lock,
  sleep 
)    /* nop */
#define lock_basic_unlock (   lock)    /* nop */
#define LOCKRET (   func)
Value:
do { \
int err; \
if ( (err=(func)) != 0) \
ods_log_error("%s at %d could not " #func ": %s", \
__FILE__, __LINE__, strerror(err)); \
} while(0)
void ods_log_error(const char *format,...)
Definition: log.c:334

Threading and locking.

Definition at line 41 of file locks.h.

#define ods_thread_create (   thr,
  func,
  arg 
)    ods_thr_fork_create(thr, func, arg)

Definition at line 104 of file locks.h.

Referenced by cmdhandler_start(), engine_start_drudgers(), and ods_thr_fork_wait().

#define ods_thread_detach (   thr)    /* nop */

Definition at line 105 of file locks.h.

Referenced by cmdhandler_start().

#define ods_thread_join (   thr)    ods_thr_fork_wait(thr)

Definition at line 107 of file locks.h.

Referenced by engine_start_drudgers(), and engine_stop_drudgers().

#define ods_thread_self ( )    getpid()

Definition at line 106 of file locks.h.

#define PTHREADS_DISABLED   1

Definition at line 89 of file locks.h.

Typedef Documentation

typedef int lock_basic_type

Definition at line 91 of file locks.h.

typedef pid_t ods_thread_type

Definition at line 103 of file locks.h.

Function Documentation

void ods_thr_fork_create ( ods_thread_type thr,
void *(*)(void *)  func,
void *  arg 
)

No threading available: fork a new process. This means no shared data structure, and no locking. Only the main thread ever returns. Exits on errors.

Parameters
thrthe location where to store the thread-id.
funcfunction body of the thread. Return value of func is lost.
arguser argument to func.

Definition at line 63 of file locks.c.

References ods_fatal_exit().

void ods_thr_fork_wait ( ods_thread_type  thread)

There is no threading. Wait for a process to terminate. Note that ub_thread_t is defined as pid_t.

Parameters
threadthe process id to wait for.

Definition at line 88 of file locks.c.

References ods_log_error(), ods_log_warning(), and ods_thread_create.

void ods_thread_blocksigs ( void  )

Definition at line 173 of file locks.c.

References ods_fatal_exit().