2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-03 16:15:27 +00:00

Remove unused isc_mutexblock and isc_condition units

The isc_mutexblock and isc_condition units were no longer in use and
were removed.
This commit is contained in:
Ondřej Surý
2025-02-28 21:01:29 +01:00
parent e02d73e7e3
commit 2aa70fff76
21 changed files with 0 additions and 266 deletions

View File

@@ -20,7 +20,6 @@
#include <isc/attributes.h>
#include <isc/buffer.h>
#include <isc/commandline.h>
#include <isc/condition.h>
#include <isc/lib.h>
#include <isc/loop.h>
#include <isc/netaddr.h>

View File

@@ -25,7 +25,6 @@
#include <string.h>
#include <unistd.h>
#include <isc/condition.h>
#include <isc/log.h>
#include <isc/loop.h>
#include <isc/mutex.h>

View File

@@ -30,7 +30,6 @@
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/mutex.h>
#include <isc/mutexblock.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/thread.h>

View File

@@ -15,7 +15,6 @@ libisc_la_HEADERS = \
include/isc/base64.h \
include/isc/buffer.h \
include/isc/commandline.h \
include/isc/condition.h \
include/isc/counter.h \
include/isc/crypto.h \
include/isc/dir.h \
@@ -51,7 +50,6 @@ libisc_la_HEADERS = \
include/isc/mem.h \
include/isc/meminfo.h \
include/isc/mutex.h \
include/isc/mutexblock.h \
include/isc/net.h \
include/isc/netaddr.h \
include/isc/netmgr.h \
@@ -122,7 +120,6 @@ libisc_la_SOURCES = \
base32.c \
base64.c \
commandline.c \
condition.c \
counter.c \
crypto.c \
dir.c \
@@ -159,7 +156,6 @@ libisc_la_SOURCES = \
meminfo.c \
mutex.c \
mutex_p.h \
mutexblock.c \
net.c \
netaddr.c \
netscope.c \

View File

@@ -18,7 +18,6 @@
#include <isc/async.h>
#include <isc/atomic.h>
#include <isc/barrier.h>
#include <isc/condition.h>
#include <isc/job.h>
#include <isc/loop.h>
#include <isc/magic.h>

View File

@@ -1,65 +0,0 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* SPDX-License-Identifier: MPL-2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
/*! \file */
#include <errno.h>
#include <isc/condition.h>
#include <isc/strerr.h>
#include <isc/string.h>
#include <isc/time.h>
#include <isc/util.h>
isc_result_t
isc__condition_waituntil(pthread_cond_t *c, pthread_mutex_t *m, isc_time_t *t) {
int presult;
isc_result_t result;
struct timespec ts;
REQUIRE(c != NULL && m != NULL && t != NULL);
/*
* POSIX defines a timespec's tv_sec as time_t.
*/
result = isc_time_secondsastimet(t, &ts.tv_sec);
/*
* If we have a range error ts.tv_sec is most probably a signed
* 32 bit value. Set ts.tv_sec to INT_MAX. This is a kludge.
*/
if (result == ISC_R_RANGE) {
ts.tv_sec = INT_MAX;
} else if (result != ISC_R_SUCCESS) {
return result;
}
/*!
* POSIX defines a timespec's tv_nsec as long. isc_time_nanoseconds
* ensures its return value is < 1 billion, which will fit in a long.
*/
ts.tv_nsec = (long)isc_time_nanoseconds(t);
do {
presult = pthread_cond_timedwait(c, m, &ts);
if (presult == 0) {
return ISC_R_SUCCESS;
}
if (presult == ETIMEDOUT) {
return ISC_R_TIMEDOUT;
}
} while (presult == EINTR);
UNEXPECTED_SYSERROR(presult, "pthread_cond_timedwait()");
return ISC_R_UNEXPECTED;
}

View File

@@ -17,7 +17,6 @@
#include <isc/atomic.h>
#include <isc/barrier.h>
#include <isc/condition.h>
#include <isc/helper.h>
#include <isc/job.h>
#include <isc/loop.h>

View File

@@ -1,97 +0,0 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* SPDX-License-Identifier: MPL-2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
#pragma once
/*! \file */
#include <errno.h>
#include <stdlib.h>
#include <isc/error.h>
#include <isc/mutex.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/types.h>
#include <isc/util.h>
/*
* We use macros instead of static inline functions so that the exact code
* location can be reported when PTHREADS_RUNTIME_CHECK() fails or when mutrace
* reports lock contention.
*/
#ifdef ISC_TRACK_PTHREADS_OBJECTS
typedef pthread_cond_t *isc_condition_t;
#define isc_condition_init(cp) \
{ \
*cp = malloc(sizeof(**cp)); \
isc__condition_init(*cp); \
}
#define isc_condition_wait(cp, mp) isc__condition_wait(*cp, *mp)
#define isc_condition_waituntil(cp, mp, t) isc__condition_waituntil(*cp, *mp, t)
#define isc_condition_signal(cp) isc__condition_signal(*cp)
#define isc_condition_broadcast(cp) isc__condition_broadcast(*cp)
#define isc_condition_destroy(cp) \
{ \
isc__condition_destroy(*cp); \
free(*cp); \
}
#else /* ISC_TRACK_PTHREADS_OBJECTS */
typedef pthread_cond_t isc_condition_t;
#define isc_condition_init(cond) isc__condition_init(cond)
#define isc_condition_wait(cp, mp) isc__condition_wait(cp, mp)
#define isc_condition_waituntil(cp, mp, t) isc__condition_waituntil(cp, mp, t)
#define isc_condition_signal(cp) isc__condition_signal(cp)
#define isc_condition_broadcast(cp) isc__condition_broadcast(cp)
#define isc_condition_destroy(cp) isc__condition_destroy(cp)
#endif /* ISC_TRACK_PTHREADS_OBJECTS */
#define isc__condition_init(cond) \
{ \
int _ret = pthread_cond_init(cond, NULL); \
PTHREADS_RUNTIME_CHECK(pthread_cond_init, _ret); \
}
#define isc__condition_wait(cp, mp) \
{ \
int _ret = pthread_cond_wait(cp, mp); \
PTHREADS_RUNTIME_CHECK(pthread_cond_wait, _ret); \
}
#define isc__condition_signal(cp) \
{ \
int _ret = pthread_cond_signal(cp); \
PTHREADS_RUNTIME_CHECK(pthread_cond_signal, _ret); \
}
#define isc__condition_broadcast(cp) \
{ \
int _ret = pthread_cond_broadcast(cp); \
PTHREADS_RUNTIME_CHECK(pthread_cond_broadcast, _ret); \
}
#define isc__condition_destroy(cp) \
{ \
int _ret = pthread_cond_destroy(cp); \
PTHREADS_RUNTIME_CHECK(pthread_cond_destroy, _ret); \
}
isc_result_t
isc__condition_waituntil(pthread_cond_t *, pthread_mutex_t *, isc_time_t *);

View File

@@ -1,49 +0,0 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* SPDX-License-Identifier: MPL-2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
#pragma once
/*! \file isc/mutexblock.h */
#include <isc/mutex.h>
#include <isc/types.h>
void
isc_mutexblock_init(isc_mutex_t *block, unsigned int count);
/*%<
* Initialize a block of locks. If an error occurs all initialized locks
* will be destroyed, if possible.
*
* Requires:
*
*\li block != NULL
*
*\li count > 0
*
*/
void
isc_mutexblock_destroy(isc_mutex_t *block, unsigned int count);
/*%<
* Destroy a block of locks.
*
* Requires:
*
*\li block != NULL
*
*\li count > 0
*
*\li Each lock in the block be initialized via isc_mutex_init() or
* the whole block was initialized via isc_mutex_initblock().
*
*/

View File

@@ -17,7 +17,6 @@
#include <isc/atomic.h>
#include <isc/barrier.h>
#include <isc/condition.h>
#include <isc/job.h>
#include <isc/list.h>
#include <isc/loop.h>

View File

@@ -18,7 +18,6 @@
#include <isc/async.h>
#include <isc/atomic.h>
#include <isc/barrier.h>
#include <isc/condition.h>
#include <isc/job.h>
#include <isc/list.h>
#include <isc/log.h>

View File

@@ -1,35 +0,0 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* SPDX-License-Identifier: MPL-2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
/*! \file */
#include <isc/mutexblock.h>
#include <isc/util.h>
void
isc_mutexblock_init(isc_mutex_t *block, unsigned int count) {
unsigned int i;
for (i = 0; i < count; i++) {
isc_mutex_init(&block[i]);
}
}
void
isc_mutexblock_destroy(isc_mutex_t *block, unsigned int count) {
unsigned int i;
for (i = 0; i < count; i++) {
isc_mutex_destroy(&block[i]);
}
}

View File

@@ -21,7 +21,6 @@
#include <isc/atomic.h>
#include <isc/barrier.h>
#include <isc/buffer.h>
#include <isc/condition.h>
#include <isc/dnsstream.h>
#include <isc/magic.h>
#include <isc/mem.h>

View File

@@ -20,7 +20,6 @@
#include <isc/backtrace.h>
#include <isc/barrier.h>
#include <isc/buffer.h>
#include <isc/condition.h>
#include <isc/errno.h>
#include <isc/job.h>
#include <isc/list.h>

View File

@@ -18,7 +18,6 @@
#include <isc/atomic.h>
#include <isc/barrier.h>
#include <isc/buffer.h>
#include <isc/condition.h>
#include <isc/errno.h>
#include <isc/log.h>
#include <isc/magic.h>

View File

@@ -21,7 +21,6 @@
#include <isc/async.h>
#include <isc/atomic.h>
#include <isc/buffer.h>
#include <isc/condition.h>
#include <isc/log.h>
#include <isc/magic.h>
#include <isc/mem.h>

View File

@@ -17,7 +17,6 @@
#include <isc/atomic.h>
#include <isc/barrier.h>
#include <isc/buffer.h>
#include <isc/condition.h>
#include <isc/errno.h>
#include <isc/magic.h>
#include <isc/mem.h>

View File

@@ -17,7 +17,6 @@
#include <isc/async.h>
#include <isc/atomic.h>
#include <isc/condition.h>
#include <isc/heap.h>
#include <isc/job.h>
#include <isc/log.h>

View File

@@ -40,7 +40,6 @@
#include <isc/magic.h>
#include <isc/mem.h>
#include <isc/mutex.h>
#include <isc/mutexblock.h>
#include <isc/once.h>
#include <isc/random.h>
#include <isc/refcount.h>

View File

@@ -34,7 +34,6 @@
#include <isc/async.h>
#include <isc/atomic.h>
#include <isc/buffer.h>
#include <isc/condition.h>
#include <isc/lib.h>
#include <isc/mutex.h>
#include <isc/netmgr.h>

View File

@@ -25,7 +25,6 @@
#include <isc/atomic.h>
#include <isc/commandline.h>
#include <isc/condition.h>
#include <isc/job.h>
#include <isc/lib.h>
#include <isc/loop.h>