Commit c692da21 authored by Ondřej Surý's avatar Ondřej Surý Committed by Witold Krecicki

Improve autoconf pthread detection

parent 5cdb38c2
# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
# generated automatically by aclocal 1.16.1 -*- Autoconf -*-
# Copyright (C) 1996-2017 Free Software Foundation, Inc.
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -12,9 +12,9 @@
# PARTICULAR PURPOSE.
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
dnl serial 11 (pkg-config-0.29.1)
dnl
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
# serial 12 (pkg-config-0.29.2)
dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
dnl
......@@ -55,7 +55,7 @@ dnl
dnl See the "Since" comment for each macro you use to see what version
dnl of the macros you require.
m4_defun([PKG_PREREQ],
[m4_define([PKG_MACROS_VERSION], [0.29.1])
[m4_define([PKG_MACROS_VERSION], [0.29.2])
m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
[m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
])dnl PKG_PREREQ
......@@ -156,7 +156,7 @@ AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
pkg_failed=no
AC_MSG_CHECKING([for $1])
AC_MSG_CHECKING([for $2])
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
......@@ -166,11 +166,11 @@ and $1[]_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.])
if test $pkg_failed = yes; then
AC_MSG_RESULT([no])
AC_MSG_RESULT([no])
_PKG_SHORT_ERRORS_SUPPORTED
if test $_pkg_short_errors_supported = yes; then
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
else
else
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
......@@ -187,7 +187,7 @@ installed software in a non-standard prefix.
_PKG_TEXT])[]dnl
])
elif test $pkg_failed = untried; then
AC_MSG_RESULT([no])
AC_MSG_RESULT([no])
m4_default([$4], [AC_MSG_FAILURE(
[The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
......@@ -289,6 +289,7 @@ AS_VAR_IF([$1], [""], [$5], [$4])dnl
])dnl PKG_CHECK_VAR
m4_include([m4/ax_check_openssl.m4])
m4_include([m4/ax_pthread.m4])
m4_include([m4/libtool.m4])
m4_include([m4/ltoptions.m4])
m4_include([m4/ltsugar.m4])
......
......@@ -326,36 +326,21 @@ int sigwait(const unsigned int *set, int *sig);
/* Define to 1 if you have the <krb5/krb5.h> header file. */
#undef HAVE_KRB5_KRB5_H
/* Define to 1 if you have the `c' library (-lc). */
#undef HAVE_LIBC
/* if system have backtrace function */
#undef HAVE_LIBCTRACE
/* Define to 1 if you have the `c_r' library (-lc_r). */
#undef HAVE_LIBC_R
/* Define if libidn2 was found */
#undef HAVE_LIBIDN2
/* Define to 1 if you have the `nsl' library (-lnsl). */
#undef HAVE_LIBNSL
/* Define to 1 if you have the `pthread' library (-lpthread). */
#undef HAVE_LIBPTHREAD
/* Define to 1 if you have the `rt' library (-lrt). */
#undef HAVE_LIBRT
/* Define to 1 if you have the `scf' library (-lscf). */
#undef HAVE_LIBSCF
/* Define to 1 if you have the `socket' library (-lsocket). */
#undef HAVE_LIBSOCKET
/* Define to 1 if you have the `thr' library (-lthr). */
#undef HAVE_LIBTHR
/* Define if libxml2 was found */
#undef HAVE_LIBXML2
......@@ -389,12 +374,24 @@ int sigwait(const unsigned int *set, int *sig);
/* define if OpenSSL supports Ed25519 */
#undef HAVE_OPENSSL_ED25519
/* Define if you have POSIX threads libraries and header files. */
#undef HAVE_PTHREAD
/* Define to 1 if you have the `pthread_attr_getstacksize' function. */
#undef HAVE_PTHREAD_ATTR_GETSTACKSIZE
/* Define to 1 if you have the `pthread_attr_setstacksize' function. */
#undef HAVE_PTHREAD_ATTR_SETSTACKSIZE
/* Support for PTHREAD_MUTEX_ADAPTIVE_NP */
#undef HAVE_PTHREAD_MUTEX_ADAPTIVE_NP
/* Define to 1 if you have the <pthread_np.h> header file. */
#undef HAVE_PTHREAD_NP_H
/* Have PTHREAD_PRIO_INHERIT. */
#undef HAVE_PTHREAD_PRIO_INHERIT
/* Define to 1 if you have the `pthread_setname_np' function. */
#undef HAVE_PTHREAD_SETNAME_NP
......@@ -443,6 +440,9 @@ int sigwait(const unsigned int *set, int *sig);
/* Define to 1 if you have the `setresuid' function. */
#undef HAVE_SETRESUID
/* Define to 1 if you have the `sigwait' function. */
#undef HAVE_SIGWAIT
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
......@@ -589,6 +589,10 @@ int sigwait(const unsigned int *set, int *sig);
(O_NDELAY/O_NONBLOCK). */
#undef PORT_NONBLOCK
/* Define to necessary symbol if this constant uses a non-standard name on
your system. */
#undef PTHREAD_CREATE_JOINABLE
/* The size of `void *', as computed by sizeof. */
#undef SIZEOF_VOID_P
......
This diff is collapsed.
......@@ -837,221 +837,51 @@ AC_SUBST(CHECK_DSA)
#
AC_CHECK_FUNCS(arc4random arc4random_buf arc4random_uniform getrandom)
sinclude(config.threads.in)dnl
AX_PTHREAD
if $use_threads
then
if test "X$GCC" = "Xyes"; then
case "$host" in
*-freebsd*)
CC="$CC -pthread"
CCOPT="$CCOPT -pthread"
CCNOOPT="$CCNOOPT -pthread"
STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
;;
*-openbsd*)
CC="$CC -pthread"
CCOPT="$CCOPT -pthread"
CCNOOPT="$CCNOOPT -pthread"
;;
*-solaris*)
LIBS="$LIBS -lthread"
;;
*-ibm-aix*)
STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
;;
esac
else
case $host in
*-dec-osf*)
CC="$CC -pthread"
CCOPT="$CCOPT -pthread"
CCNOOPT="$CCNOOPT -pthread"
;;
*-solaris*)
CC="$CC -mt"
CCOPT="$CCOPT -mt"
CCNOOPT="$CCNOOPT -mt"
;;
*-ibm-aix*)
STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
;;
*-sco-sysv*uw*|*-*-sysv*UnixWare*)
CC="$CC -Kthread"
CCOPT="$CCOPT -Kthread"
CCNOOPT="$CCNOOPT -Kthread"
;;
*-*-sysv*OpenUNIX*)
CC="$CC -Kpthread"
CCOPT="$CCOPT -Kpthread"
CCNOOPT="$CCNOOPT -Kpthread"
;;
esac
fi
ALWAYS_DEFINES="-D_REENTRANT"
ISC_PLATFORM_USETHREADS="#define ISC_PLATFORM_USETHREADS 1"
THREADOPTOBJS='${THREADOPTOBJS}'
THREADOPTSRCS='${THREADOPTSRCS}'
thread_dir=pthreads
#
# We'd like to use sigwait() too
#
AC_CHECK_FUNC(sigwait,
AC_DEFINE(HAVE_SIGWAIT),
AC_CHECK_LIB(c, sigwait,
AC_DEFINE(HAVE_SIGWAIT),
AC_CHECK_LIB(pthread, sigwait,
AC_DEFINE(HAVE_SIGWAIT),
AC_CHECK_LIB(pthread, _Psigwait,
AC_DEFINE(HAVE_SIGWAIT),))))
AC_CHECK_FUNC(pthread_attr_getstacksize,
AC_DEFINE(HAVE_PTHREAD_ATTR_GETSTACKSIZE),)
AC_CHECK_FUNC(pthread_attr_setstacksize,
AC_DEFINE(HAVE_PTHREAD_ATTR_SETSTACKSIZE),)
AC_ARG_WITH(locktype,
AS_HELP_STRING([--with-locktype=ARG],
[Specify mutex lock type
(adaptive or standard)]),
locktype="$withval", locktype="adaptive")
case "$locktype" in
adaptive)
AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <pthread.h>
]], [[
return (PTHREAD_MUTEX_ADAPTIVE_NP);
]])],
[ AC_MSG_RESULT(using adaptive lock type)
AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
[Support for PTHREAD_MUTEX_ADAPTIVE_NP]) ],
[ AC_MSG_RESULT(using standard lock type) ])
;;
standard)
AC_MSG_RESULT(using standard lock type)
;;
*)
AC_MSG_ERROR([You must specify "adaptive" or "standard" for --with-locktype.])
;;
esac
AC_CHECK_HEADERS(sched.h)
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC"
case "$host" in
*-freebsd*)
CC="$CC -pthread"
CCOPT="$CCOPT -pthread"
CCNOOPT="$CCNOOPT -pthread"
STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
;;
*-openbsd*)
CC="$CC -pthread"
CCOPT="$CCOPT -pthread"
CCNOOPT="$CCNOOPT -pthread"
;;
*-solaris*)
LIBS="$LIBS -lthread"
;;
*-ibm-aix*)
STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
;;
esac
else
case $host in
*-dec-osf*)
CC="$CC -pthread"
CCOPT="$CCOPT -pthread"
CCNOOPT="$CCNOOPT -pthread"
;;
*-solaris*)
CC="$CC -mt"
CCOPT="$CCOPT -mt"
CCNOOPT="$CCNOOPT -mt"
;;
*-ibm-aix*)
STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
;;
*-sco-sysv*uw*|*-*-sysv*UnixWare*)
CC="$CC -Kthread"
CCOPT="$CCOPT -Kthread"
CCNOOPT="$CCNOOPT -Kthread"
;;
*-*-sysv*OpenUNIX*)
CC="$CC -Kpthread"
CCOPT="$CCOPT -Kpthread"
CCNOOPT="$CCNOOPT -Kpthread"
;;
esac
fi
ALWAYS_DEFINES="-D_REENTRANT"
THREADOPTOBJS='${THREADOPTOBJS}'
THREADOPTSRCS='${THREADOPTSRCS}'
thread_dir=pthreads
#
# We'd like to use sigwait() too
#
AC_CHECK_FUNC(sigwait,
AC_DEFINE(HAVE_SIGWAIT),
AC_CHECK_LIB(c, sigwait,
AC_DEFINE(HAVE_SIGWAIT),
AC_CHECK_LIB(pthread, sigwait,
AC_DEFINE(HAVE_SIGWAIT),
AC_CHECK_LIB(pthread, _Psigwait,
AC_DEFINE(HAVE_SIGWAIT),))))
AC_CHECK_FUNC(pthread_attr_getstacksize,
AC_DEFINE(HAVE_PTHREAD_ATTR_GETSTACKSIZE),)
AC_CHECK_FUNCS([sigwait pthread_attr_getstacksize pthread_attr_setstacksize])
AC_CHECK_FUNC(pthread_attr_setstacksize,
AC_DEFINE(HAVE_PTHREAD_ATTR_SETSTACKSIZE),)
AC_ARG_WITH(locktype,
AC_ARG_WITH([locktype],
AS_HELP_STRING([--with-locktype=ARG],
[Specify mutex lock type
(adaptive or standard)]),
locktype="$withval", locktype="adaptive")
case "$locktype" in
adaptive)
AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <pthread.h>
]], [[
return (PTHREAD_MUTEX_ADAPTIVE_NP);
]])],
[ AC_MSG_RESULT(using adaptive lock type)
AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
[Support for PTHREAD_MUTEX_ADAPTIVE_NP]) ],
[ AC_MSG_RESULT(using standard lock type) ])
;;
standard)
AC_MSG_RESULT(using standard lock type)
;;
*)
AC_MSG_ERROR([You must specify "adaptive" or "standard" for --with-locktype.])
;;
esac
AC_CHECK_HEADERS(sched.h)
case "$host" in
*solaris-*)
AC_CHECK_LIB(rt, sched_yield)
;;
esac
AC_CHECK_FUNCS(sched_yield pthread_yield pthread_yield_np)
(adaptive or standard)]),
[], [with_locktype="adaptive"])
AS_CASE([$with_locktype],
[adaptive],[
AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <pthread.h>
]],
[[
return (PTHREAD_MUTEX_ADAPTIVE_NP);
]]
)],
[AC_MSG_RESULT([using adaptive lock type])
AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
[Support for PTHREAD_MUTEX_ADAPTIVE_NP]) ],
[AC_MSG_RESULT([using standard lock type])]
)],
[standard],[AC_MSG_RESULT([using standard lock type])],
[AC_MSG_ERROR([You must specify "adaptive" or "standard" for --with-locktype.])]
)
AC_CHECK_HEADERS([sched.h])
AC_SEARCH_LIBS([sched_yield],[rt])
AC_CHECK_FUNCS([sched_yield pthread_yield pthread_yield_np])
#
# Additional OS-specific issues related to pthreads and sigwait.
......@@ -1105,7 +935,7 @@ case "$host" in
esac
# Look for functions relating to thread naming
AC_CHECK_FUNCS(pthread_setname_np pthread_set_name_np)
AC_CHECK_FUNCS([pthread_setname_np pthread_set_name_np])
AC_CHECK_HEADERS([pthread_np.h], [], [], [#include <pthread.h>])
#
......@@ -1114,10 +944,6 @@ AC_CHECK_HEADERS([pthread_np.h], [], [], [#include <pthread.h>])
AC_CHECK_FUNC(sysconf, AC_DEFINE(HAVE_SYSCONF),)
AC_SUBST(ALWAYS_DEFINES)
AC_SUBST(THREADOPTOBJS)
AC_SUBST(THREADOPTSRCS)
ISC_THREAD_DIR=$thread_dir
AC_SUBST(ISC_THREAD_DIR)
AC_MSG_CHECKING(for libtool)
AC_ARG_WITH(libtool, AS_HELP_STRING([--with-libtool], [use GNU libtool]),
......@@ -4476,9 +4302,9 @@ AC_CONFIG_FILES([
lib/isc/$arch/Makefile
lib/isc/$arch/include/Makefile
lib/isc/$arch/include/isc/Makefile
lib/isc/$thread_dir/Makefile
lib/isc/$thread_dir/include/Makefile
lib/isc/$thread_dir/include/isc/Makefile
lib/isc/pthreads/Makefile
lib/isc/pthreads/include/Makefile
lib/isc/pthreads/include/isc/Makefile
lib/isc/Makefile
lib/isc/include/Makefile
lib/isc/include/isc/Makefile
......
......@@ -18,7 +18,7 @@ VERSION=@BIND9_VERSION@
@BIND9_MAKE_INCLUDES@
CINCLUDES = -I${srcdir}/unix/include \
-I${srcdir}/@ISC_THREAD_DIR@/include \
-I${srcdir}/pthreads/include \
-I${srcdir}/@ISC_ARCH_DIR@/include \
-I./include \
-I${srcdir}/include ${DNS_INCLUDES} @OPENSSL_INCLUDES@
......@@ -36,9 +36,7 @@ UNIXOBJS = @ISC_ISCIPV6_O@ unix/pk11_api.@O@ \
NLSOBJS = nls/msgcat.@O@
THREADOPTOBJS = @ISC_THREAD_DIR@/condition.@O@ @ISC_THREAD_DIR@/mutex.@O@
THREADOBJS = @THREADOPTOBJS@ @ISC_THREAD_DIR@/thread.@O@
THREADOBJS = pthreads/condition.@O@ pthreads/mutex.@O@ pthreads/thread.@O@
WIN32OBJS = win32/condition.@O@ win32/dir.@O@ win32/errno.@O@ \
win32/file.@O@ win32/fsaccess.@O@ \
......@@ -85,7 +83,7 @@ LIBS = @OPENSSL_LIBS@ @LIBS@
# Attempt to disable parallel processing.
.NOTPARALLEL:
.NO_PARALLEL:
SUBDIRS = include unix nls @ISC_THREAD_DIR@ @ISC_ARCH_DIR@
SUBDIRS = include unix nls pthreads @ISC_ARCH_DIR@
TARGETS = timestamp
TESTDIRS = @UNITTESTS@
......
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# 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 http://mozilla.org/MPL/2.0/.
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
top_srcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
CINCLUDES = -I${srcdir}/include \
-I${srcdir}/../unix/include \
-I../include \
-I${srcdir}/../include \
-I${srcdir}/..
CDEFINES =
CWARNINGS =
THREADOPTOBJS = condition.@O@ mutex.@O@
OBJS = @THREADOPTOBJS@ thread.@O@
THREADOPTSRCS = condition.c mutex.c
SRCS = @THREADOPTSRCS@ thread.c
SUBDIRS = include
TARGETS = ${OBJS}
@BIND9_MAKE_RULES@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* 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 http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
#include <config.h>
#include <isc/util.h>
EMPTY_TRANSLATION_UNIT
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# 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 http://mozilla.org/MPL/2.0/.
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
srcdir = @srcdir@
VPATH = @srcdir@
top_srcdir = @top_srcdir@
SUBDIRS = isc
TARGETS =
@BIND9_MAKE_RULES@
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# 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 http://mozilla.org/MPL/2.0/.
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
srcdir = @srcdir@
VPATH = @srcdir@
top_srcdir = @top_srcdir@
VERSION=@BIND9_VERSION@
HEADERS = condition.h mutex.h once.h thread.h
SUBDIRS =
TARGETS =
@BIND9_MAKE_RULES@
installdirs:
$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${includedir}/isc
install:: installdirs
for i in ${HEADERS}; do \
${INSTALL_DATA} $(srcdir)/$$i ${DESTDIR}${includedir}/isc ; \
done
uninstall::
for i in ${HEADERS}; do \
rm -f ${DESTDIR}${includedir}/isc/$$i ; \
done
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* 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 http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
/*
* This provides a limited subset of the isc_condition_t
* functionality for use by single-threaded programs that
* need to block waiting for events. Only a single
* call to isc_condition_wait() may be blocked at any given
* time, and the _waituntil and _broadcast functions are not
* supported. This is intended primarily for use by the omapi
* library, and may go away once omapi goes away. Use for
* other purposes is strongly discouraged.
*/
#ifndef ISC_CONDITION_H
#define ISC_CONDITION_H 1
#include <isc/mutex.h>
typedef int isc_condition_t;
isc_result_t isc__nothread_wait_hack(isc_condition_t *cp, isc_mutex_t *mp);
isc_result_t isc__nothread_signal_hack(isc_condition_t *cp);
#define isc_condition_init(cp) \
(*(cp) = 0, ISC_R_SUCCESS)
#define isc_condition_wait(cp, mp) \
isc__nothread_wait_hack(cp, mp)
#define isc_condition_waituntil(cp, mp, tp) \
((void)(cp), (void)(mp), (void)(tp), ISC_R_NOTIMPLEMENTED)
#define isc_condition_signal(cp) \
isc__nothread_signal_hack(cp)
#define isc_condition_broadcast(cp) \
((void)(cp), ISC_R_NOTIMPLEMENTED)
#define isc_condition_destroy(cp) \
(*(cp) == 0 ? (*(cp) = -1, ISC_R_SUCCESS) : ISC_R_UNEXPECTED)
#endif /* ISC_CONDITION_H */
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* 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 http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
#ifndef ISC_MUTEX_H
#define ISC_MUTEX_H 1
#include <isc/result.h> /* for ISC_R_ codes */
typedef int isc_mutex_t;
#define isc_mutex_init(mp) \
(*(mp) = 0, ISC_R_SUCCESS)
#define isc_mutex_lock(mp) \
((*(mp))++ == 0 ? ISC_R_SUCCESS : ISC_R_UNEXPECTED)
#define isc_mutex_unlock(mp) \
(--(*(mp)) == 0 ? ISC_R_SUCCESS : ISC_R_UNEXPECTED)
#define isc_mutex_trylock(mp) \
(*(mp) == 0 ? ((*(mp))++, ISC_R_SUCCESS) : ISC_R_LOCKBUSY)
#define isc_mutex_destroy(mp) \
(*(mp) == 0 ? (*(mp) = -1, ISC_R_SUCCESS) : ISC_R_UNEXPECTED)
#define isc_mutex_stats(fp)
#endif /* ISC_MUTEX_H */
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* 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 http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
#ifndef ISC_ONCE_H
#define ISC_ONCE_H 1
#include <stdbool.h>
#include <isc/result.h>
typedef bool isc_once_t;
#define ISC_ONCE_INIT false
#define isc_once_do(op, f) \
(!*(op) ? (f(), *(op) = true, ISC_R_SUCCESS) : ISC_R_SUCCESS)
#endif /* ISC_ONCE_H */
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* 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 http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
#ifndef ISC_THREAD_H
#define ISC_THREAD_H 1
#include <isc/lang.h>
#include <isc/result.h>
ISC_LANG_BEGINDECLS
/* Placeholder types (they are not accessed) */
typedef void * isc_thread_t;
typedef void * isc_threadresult_t;
typedef void * isc_threadarg_t;
typedef void * isc_threadfunc_t;
typedef void * isc_thread_key_t;
void
isc_thread_setconcurrency(unsigned int level);
void
isc_thread_setname(isc_thread_t thread, const char *name);
#define isc_thread_self() ((unsigned long)0)
#define isc_thread_yield() ((void)0)