Deleted Added
full compact
locks.h (266114) locks.h (276605)
1/**
2 * util/locks.h - unbound locking primitives
3 *
4 * Copyright (c) 2007, NLnet Labs. All rights reserved.
5 *
6 * This software is open source.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 41 unchanged lines hidden (view full) ---

50 * o lock_basic: simple mutex. Blocking, one person has access only.
51 * This lock is meant for non performance sensitive uses.
52 * o lock_quick: speed lock. For performance sensitive locking of critical
53 * sections. Could be implemented by a mutex or a spinlock.
54 *
55 * Also thread creation and deletion functions are defined here.
56 */
57
1/**
2 * util/locks.h - unbound locking primitives
3 *
4 * Copyright (c) 2007, NLnet Labs. All rights reserved.
5 *
6 * This software is open source.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 41 unchanged lines hidden (view full) ---

50 * o lock_basic: simple mutex. Blocking, one person has access only.
51 * This lock is meant for non performance sensitive uses.
52 * o lock_quick: speed lock. For performance sensitive locking of critical
53 * sections. Could be implemented by a mutex or a spinlock.
54 *
55 * Also thread creation and deletion functions are defined here.
56 */
57
58/* if you define your own LOCKRET before including locks.h, you can get most
59 * locking functions without the dependency on log_err. */
60#ifndef LOCKRET
58#include "util/log.h"
61#include "util/log.h"
59
60/**
61 * The following macro is used to check the return value of the
62 * pthread calls. They return 0 on success and an errno on error.
63 * The errno is logged to the logfile with a descriptive comment.
64 */
65#define LOCKRET(func) do {\
66 int lockret_err; \
67 if( (lockret_err=(func)) != 0) \
68 log_err("%s at %d could not " #func ": %s", \
69 __FILE__, __LINE__, strerror(lockret_err)); \
70 } while(0)
62/**
63 * The following macro is used to check the return value of the
64 * pthread calls. They return 0 on success and an errno on error.
65 * The errno is logged to the logfile with a descriptive comment.
66 */
67#define LOCKRET(func) do {\
68 int lockret_err; \
69 if( (lockret_err=(func)) != 0) \
70 log_err("%s at %d could not " #func ": %s", \
71 __FILE__, __LINE__, strerror(lockret_err)); \
72 } while(0)
73#endif
71
72/** DEBUG: use thread debug whenever possible */
73#if defined(HAVE_PTHREAD) && defined(HAVE_PTHREAD_SPINLOCK_T) && defined(ENABLE_LOCK_CHECKS)
74# define USE_THREAD_DEBUG
75#endif
76
77#ifdef USE_THREAD_DEBUG
78/******************* THREAD DEBUG ************************/

--- 215 unchanged lines hidden ---
74
75/** DEBUG: use thread debug whenever possible */
76#if defined(HAVE_PTHREAD) && defined(HAVE_PTHREAD_SPINLOCK_T) && defined(ENABLE_LOCK_CHECKS)
77# define USE_THREAD_DEBUG
78#endif
79
80#ifdef USE_THREAD_DEBUG
81/******************* THREAD DEBUG ************************/

--- 215 unchanged lines hidden ---