mirror of
https://github.com/NLnetLabs/unbound.git
synced 2026-01-17 20:22:54 -05:00
Please older compilers.
git-svn-id: file:///svn/unbound/trunk@170 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
9d89d05bd1
commit
39da393425
4 changed files with 16 additions and 15 deletions
|
|
@ -5,6 +5,7 @@
|
|||
- log_hex function to dump hex strings to the logfile.
|
||||
- checklocks zeroes its destroyed lock after checking memory areas.
|
||||
- unit test for alloc.
|
||||
- identifier for union in checklocks to please older compilers.
|
||||
|
||||
8 March 2007: Wouter
|
||||
- Reviewed checklock code.
|
||||
|
|
|
|||
|
|
@ -184,13 +184,13 @@ checklock_init(enum check_lock_type type, struct checked_lock** lock,
|
|||
LOCKRET(pthread_mutex_init(&e->lock, NULL));
|
||||
switch(e->type) {
|
||||
case check_lock_mutex:
|
||||
LOCKRET(pthread_mutex_init(&e->mutex, NULL));
|
||||
LOCKRET(pthread_mutex_init(&e->u.mutex, NULL));
|
||||
break;
|
||||
case check_lock_spinlock:
|
||||
LOCKRET(pthread_spin_init(&e->spinlock, PTHREAD_PROCESS_PRIVATE));
|
||||
LOCKRET(pthread_spin_init(&e->u.spinlock, PTHREAD_PROCESS_PRIVATE));
|
||||
break;
|
||||
case check_lock_rwlock:
|
||||
LOCKRET(pthread_rwlock_init(&e->rwlock, NULL));
|
||||
LOCKRET(pthread_rwlock_init(&e->u.rwlock, NULL));
|
||||
break;
|
||||
default:
|
||||
log_assert(0);
|
||||
|
|
@ -261,13 +261,13 @@ checklock_destroy(enum check_lock_type type, struct checked_lock** lock,
|
|||
* from the thread-held locks list. */
|
||||
switch(e->type) {
|
||||
case check_lock_mutex:
|
||||
LOCKRET(pthread_mutex_destroy(&e->mutex));
|
||||
LOCKRET(pthread_mutex_destroy(&e->u.mutex));
|
||||
break;
|
||||
case check_lock_spinlock:
|
||||
LOCKRET(pthread_spin_destroy(&e->spinlock));
|
||||
LOCKRET(pthread_spin_destroy(&e->u.spinlock));
|
||||
break;
|
||||
case check_lock_rwlock:
|
||||
LOCKRET(pthread_rwlock_destroy(&e->rwlock));
|
||||
LOCKRET(pthread_rwlock_destroy(&e->u.rwlock));
|
||||
break;
|
||||
default:
|
||||
log_assert(0);
|
||||
|
|
@ -386,7 +386,7 @@ checklock_rdlock(enum check_lock_type type, struct checked_lock* lock,
|
|||
|
||||
log_assert(type == check_lock_rwlock);
|
||||
checklock_lockit(type, lock, func, file, line,
|
||||
try_rd, timed_rd, &lock->rwlock, 0, 0);
|
||||
try_rd, timed_rd, &lock->u.rwlock, 0, 0);
|
||||
}
|
||||
|
||||
/** helper for wrlock: try */
|
||||
|
|
@ -403,7 +403,7 @@ checklock_wrlock(enum check_lock_type type, struct checked_lock* lock,
|
|||
{
|
||||
log_assert(type == check_lock_rwlock);
|
||||
checklock_lockit(type, lock, func, file, line,
|
||||
try_wr, timed_wr, &lock->rwlock, 0, 1);
|
||||
try_wr, timed_wr, &lock->u.rwlock, 0, 1);
|
||||
}
|
||||
|
||||
/** helper for lock mutex: try */
|
||||
|
|
@ -439,13 +439,13 @@ checklock_lock(enum check_lock_type type, struct checked_lock* lock,
|
|||
switch(type) {
|
||||
case check_lock_mutex:
|
||||
checklock_lockit(type, lock, func, file, line,
|
||||
try_mutex, timed_mutex, &lock->mutex, 1, 0);
|
||||
try_mutex, timed_mutex, &lock->u.mutex, 1, 0);
|
||||
break;
|
||||
case check_lock_spinlock:
|
||||
/* void* cast needed because 'volatile' on some OS */
|
||||
checklock_lockit(type, lock, func, file, line,
|
||||
try_spinlock, timed_spinlock,
|
||||
(void*)&lock->spinlock, 1, 0);
|
||||
(void*)&lock->u.spinlock, 1, 0);
|
||||
break;
|
||||
default:
|
||||
log_assert(0);
|
||||
|
|
@ -507,13 +507,13 @@ checklock_unlock(enum check_lock_type type, struct checked_lock* lock,
|
|||
/* unlock it */
|
||||
switch(type) {
|
||||
case check_lock_mutex:
|
||||
LOCKRET(pthread_mutex_unlock(&lock->mutex));
|
||||
LOCKRET(pthread_mutex_unlock(&lock->u.mutex));
|
||||
break;
|
||||
case check_lock_spinlock:
|
||||
LOCKRET(pthread_spin_unlock(&lock->spinlock));
|
||||
LOCKRET(pthread_spin_unlock(&lock->u.spinlock));
|
||||
break;
|
||||
case check_lock_rwlock:
|
||||
LOCKRET(pthread_rwlock_unlock(&lock->rwlock));
|
||||
LOCKRET(pthread_rwlock_unlock(&lock->u.rwlock));
|
||||
break;
|
||||
default:
|
||||
log_assert(0);
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ struct checked_lock {
|
|||
pthread_spinlock_t spinlock;
|
||||
/** rwlock */
|
||||
pthread_rwlock_t rwlock;
|
||||
};
|
||||
} u;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ function dotest()
|
|||
configure: configure.ac
|
||||
$AC_CMD
|
||||
touch configure
|
||||
Makefile: configure
|
||||
Makefile: configure Makefile.in
|
||||
./configure $CONFIGURE_FLAGS $DISABLE
|
||||
touch Makefile
|
||||
EOF
|
||||
|
|
|
|||
Loading…
Reference in a new issue