diff options
Diffstat (limited to 'lib/isc/nothreads/include')
-rw-r--r-- | lib/isc/nothreads/include/Makefile.in | 25 | ||||
-rw-r--r-- | lib/isc/nothreads/include/isc/Makefile.in | 37 | ||||
-rw-r--r-- | lib/isc/nothreads/include/isc/condition.h | 59 | ||||
-rw-r--r-- | lib/isc/nothreads/include/isc/mutex.h | 39 | ||||
-rw-r--r-- | lib/isc/nothreads/include/isc/once.h | 32 | ||||
-rw-r--r-- | lib/isc/nothreads/include/isc/thread.h | 35 |
6 files changed, 227 insertions, 0 deletions
diff --git a/lib/isc/nothreads/include/Makefile.in b/lib/isc/nothreads/include/Makefile.in new file mode 100644 index 0000000..ecfc329 --- /dev/null +++ b/lib/isc/nothreads/include/Makefile.in @@ -0,0 +1,25 @@ +# Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2000, 2001 Internet Software Consortium. +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH +# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, +# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. + +# $Id: Makefile.in,v 1.3 2004/03/05 05:11:11 marka Exp $ + +srcdir = @srcdir@ +VPATH = @srcdir@ +top_srcdir = @top_srcdir@ + +SUBDIRS = isc +TARGETS = + +@BIND9_MAKE_RULES@ diff --git a/lib/isc/nothreads/include/isc/Makefile.in b/lib/isc/nothreads/include/isc/Makefile.in new file mode 100644 index 0000000..f6482fb --- /dev/null +++ b/lib/isc/nothreads/include/isc/Makefile.in @@ -0,0 +1,37 @@ +# Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2000, 2001 Internet Software Consortium. +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH +# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, +# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. + +# $Id: Makefile.in,v 1.5 2004/03/05 05:11:13 marka Exp $ + +srcdir = @srcdir@ +VPATH = @srcdir@ +top_srcdir = @top_srcdir@ + +@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 diff --git a/lib/isc/nothreads/include/isc/condition.h b/lib/isc/nothreads/include/isc/condition.h new file mode 100644 index 0000000..39889b1 --- /dev/null +++ b/lib/isc/nothreads/include/isc/condition.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2000, 2001 Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +/* $Id: condition.h,v 1.4 2004/03/05 05:11:13 marka Exp $ */ + +/* + * 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 */ diff --git a/lib/isc/nothreads/include/isc/mutex.h b/lib/isc/nothreads/include/isc/mutex.h new file mode 100644 index 0000000..a586435 --- /dev/null +++ b/lib/isc/nothreads/include/isc/mutex.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2000, 2001 Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +/* $Id: mutex.h,v 1.4 2004/03/05 05:11:13 marka Exp $ */ + +#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 */ diff --git a/lib/isc/nothreads/include/isc/once.h b/lib/isc/nothreads/include/isc/once.h new file mode 100644 index 0000000..470120a --- /dev/null +++ b/lib/isc/nothreads/include/isc/once.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2000, 2001 Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +/* $Id: once.h,v 1.4 2004/03/05 05:11:13 marka Exp $ */ + +#ifndef ISC_ONCE_H +#define ISC_ONCE_H 1 + +#include <isc/result.h> + +typedef isc_boolean_t isc_once_t; + +#define ISC_ONCE_INIT ISC_FALSE + +#define isc_once_do(op, f) \ + (!*(op) ? (f(), *(op) = ISC_TRUE, ISC_R_SUCCESS) : ISC_R_SUCCESS) + +#endif /* ISC_ONCE_H */ diff --git a/lib/isc/nothreads/include/isc/thread.h b/lib/isc/nothreads/include/isc/thread.h new file mode 100644 index 0000000..6c85913 --- /dev/null +++ b/lib/isc/nothreads/include/isc/thread.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2000, 2001 Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +/* $Id: thread.h,v 1.4 2004/03/05 05:11:13 marka Exp $ */ + +#ifndef ISC_THREAD_H +#define ISC_THREAD_H 1 + +#include <isc/lang.h> +#include <isc/result.h> + +ISC_LANG_BEGINDECLS + +void +isc_thread_setconcurrency(unsigned int level); + +#define isc_thread_self() ((unsigned long)0) + +ISC_LANG_ENDDECLS + +#endif /* ISC_THREAD_H */ |