4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/* $NetBSD: reentrant.h,v 1.10 2004/12/14 00:23:19 nathanw Exp $ */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/*-
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Copyright (c) 1997, 1998, 2003 The NetBSD Foundation, Inc.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * All rights reserved.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * This code is derived from software contributed to The NetBSD Foundation
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * by J.T. Conklin, by Nathan J. Williams, and by Jason R. Thorpe.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Redistribution and use in source and binary forms, with or without
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * modification, are permitted provided that the following conditions
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * are met:
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * 1. Redistributions of source code must retain the above copyright
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * notice, this list of conditions and the following disclaimer.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * 2. Redistributions in binary form must reproduce the above copyright
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * notice, this list of conditions and the following disclaimer in the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * documentation and/or other materials provided with the distribution.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * 3. All advertising materials mentioning features or use of this software
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * must display the following acknowledgement:
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * This product includes software developed by the NetBSD
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Foundation, Inc. and its contributors.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * 4. Neither the name of The NetBSD Foundation nor the names of its
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * contributors may be used to endorse or promote products derived
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * from this software without specific prior written permission.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * POSSIBILITY OF SUCH DAMAGE.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/*
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Requirements:
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * 1. The thread safe mechanism should be lightweight so the library can
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * be used by non-threaded applications without unreasonable overhead.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * 2. There should be no dependency on a thread engine for non-threaded
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * applications.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * 3. There should be no dependency on any particular thread engine.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * 4. The library should be able to be compiled without support for thread
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * safety.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Rationale:
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * One approach for thread safety is to provide discrete versions of the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * library: one thread safe, the other not. The disadvantage of this is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * that libc is rather large, and two copies of a library which are 99%+
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * identical is not an efficent use of resources.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Another approach is to provide a single thread safe library. However,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * it should not add significant run time or code size overhead to non-
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * threaded applications.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Since the NetBSD C library is used in other projects, it should be
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * easy to replace the mutual exclusion primitives with ones provided by
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * another system. Similarly, it should also be easy to remove all
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * support for thread safety completely if the target environment does
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * not support threads.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Implementation Details:
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * The thread primitives used by the library (mutex_t, mutex_lock, etc.)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * are macros which expand to the cooresponding primitives provided by
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * the thread engine or to nothing. The latter is used so that code is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * not unreasonably cluttered with #ifdefs when all thread safe support
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * is removed.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * The thread macros can be directly mapped to the mutex primitives from
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * pthreads, however it should be reasonably easy to wrap another mutex
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * implementation so it presents a similar interface.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * The thread functions operate by dispatching to symbols which are, by
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * default, weak-aliased to no-op functions in thread-stub/thread-stub.c
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * (some uses of thread operations are conditional on __isthreaded, but
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * not all of them are).
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * When the thread library is linked in, it provides strong-alias versions
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * of those symbols which dispatch to its own real thread operations.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#ifdef _REENTRANT
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/*
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Abtract thread interface for thread-safe libraries. These routines
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * will use stubs in libc if the application is not linked against the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * pthread library, and the real function in the pthread library if it
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * is.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#include <pthread.h>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#include <signal.h>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define mutex_t pthread_mutex_t
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define mutexattr_t pthread_mutexattr_t
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define MUTEX_TYPE_NORMAL PTHREAD_MUTEX_NORMAL
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define MUTEX_TYPE_ERRORCHECK PTHREAD_MUTEX_ERRORCHECK
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define MUTEX_TYPE_RECURSIVE PTHREAD_MUTEX_RECURSIVE
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define cond_t pthread_cond_t
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define COND_INITIALIZER PTHREAD_COND_INITIALIZER
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define condattr_t pthread_condattr_t
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define rwlock_t pthread_rwlock_t
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define RWLOCK_INITIALIZER PTHREAD_RWLOCK_INITIALIZER
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define rwlockattr_t pthread_rwlockattr_t
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define thread_key_t pthread_key_t
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define thr_t pthread_t
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define thrattr_t pthread_attr_t
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define once_t pthread_once_t
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define ONCE_INITIALIZER PTHREAD_ONCE_INIT
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#ifndef __LIBC_THREAD_STUBS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync__BEGIN_DECLS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint __libc_mutex_init(mutex_t *, const mutexattr_t *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint __libc_mutex_lock(mutex_t *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint __libc_mutex_trylock(mutex_t *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint __libc_mutex_unlock(mutex_t *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint __libc_mutex_destroy(mutex_t *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint __libc_mutexattr_init(mutexattr_t *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint __libc_mutexattr_settype(mutexattr_t *, int);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint __libc_mutexattr_destroy(mutexattr_t *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync__END_DECLS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define mutex_init(m, a) __libc_mutex_init((m), (a))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define mutex_lock(m) __libc_mutex_lock((m))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define mutex_trylock(m) __libc_mutex_trylock((m))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define mutex_unlock(m) __libc_mutex_unlock((m))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define mutex_destroy(m) __libc_mutex_destroy((m))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define mutexattr_init(ma) __libc_mutexattr_init((ma))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define mutexattr_settype(ma, t) __libc_mutexattr_settype((ma), (t))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define mutexattr_destroy(ma) __libc_mutexattr_destroy((ma))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync__BEGIN_DECLS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint __libc_cond_init(cond_t *, const condattr_t *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint __libc_cond_signal(cond_t *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint __libc_cond_broadcast(cond_t *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint __libc_cond_wait(cond_t *, mutex_t *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint __libc_cond_timedwait(cond_t *, mutex_t *, const struct timespec *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint __libc_cond_destroy(cond_t *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync__END_DECLS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define cond_init(c, t, a) __libc_cond_init((c), (a))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define cond_signal(c) __libc_cond_signal((c))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define cond_broadcast(c) __libc_cond_broadcast((c))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define cond_wait(c, m) __libc_cond_wait((c), (m))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define cond_timedwait(c, m, t) __libc_cond_timedwait((c), (m), (t))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define cond_destroy(c) __libc_cond_destroy((c))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync__BEGIN_DECLS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint __libc_rwlock_init(rwlock_t *, const rwlockattr_t *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint __libc_rwlock_rdlock(rwlock_t *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint __libc_rwlock_wrlock(rwlock_t *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint __libc_rwlock_tryrdlock(rwlock_t *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint __libc_rwlock_trywrlock(rwlock_t *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint __libc_rwlock_unlock(rwlock_t *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint __libc_rwlock_destroy(rwlock_t *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync__END_DECLS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define rwlock_init(l, a) __libc_rwlock_init((l), (a))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define rwlock_rdlock(l) __libc_rwlock_rdlock((l))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define rwlock_wrlock(l) __libc_rwlock_wrlock((l))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define rwlock_tryrdlock(l) __libc_rwlock_tryrdlock((l))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define rwlock_trywrlock(l) __libc_rwlock_trywrlock((l))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define rwlock_unlock(l) __libc_rwlock_unlock((l))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define rwlock_destroy(l) __libc_rwlock_destroy((l))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync__BEGIN_DECLS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint __libc_thr_keycreate(thread_key_t *, void (*)(void *));
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint __libc_thr_setspecific(thread_key_t, const void *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncvoid *__libc_thr_getspecific(thread_key_t);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint __libc_thr_keydelete(thread_key_t);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync__END_DECLS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define thr_keycreate(k, d) __libc_thr_keycreate((k), (d))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define thr_setspecific(k, p) __libc_thr_setspecific((k), (p))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define thr_getspecific(k) __libc_thr_getspecific((k))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define thr_keydelete(k) __libc_thr_keydelete((k))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync__BEGIN_DECLS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint __libc_thr_once(once_t *, void (*)(void));
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint __libc_thr_sigsetmask(int, const sigset_t *, sigset_t *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncthr_t __libc_thr_self(void);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint __libc_thr_yield(void);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncvoid __libc_thr_create(thr_t *, const thrattr_t *,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync void *(*)(void *), void *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncvoid __libc_thr_exit(void *) __attribute__((__noreturn__));
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint *__libc_thr_errno(void);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint __libc_thr_setcancelstate(int, int *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncextern int __isthreaded;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync__END_DECLS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define thr_once(o, f) __libc_thr_once((o), (f))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define thr_sigsetmask(f, n, o) __libc_thr_sigsetmask((f), (n), (o))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define thr_self() __libc_thr_self()
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define thr_yield() __libc_thr_yield()
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define thr_create(tp, ta, f, a) __libc_thr_create((tp), (ta), (f), (a))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define thr_exit(v) __libc_thr_exit((v))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define thr_errno() __libc_thr_errno()
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define thr_enabled() (__isthreaded)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define thr_setcancelstate(n, o) __libc_thr_setcancelstate((n),(o))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#endif /* __LIBC_THREAD_STUBS */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define FLOCKFILE(fp) __flockfile_internal(fp, 1)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define FUNLOCKFILE(fp) __funlockfile_internal(fp, 1)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#else /* _REENTRANT */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define mutex_init(m, a)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define mutex_lock(m)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define mutex_trylock(m)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define mutex_unlock(m)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define mutex_destroy(m)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define cond_init(c, t, a)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define cond_signal(c)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define cond_broadcast(c)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define cond_wait(c, m)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define cond_timedwait(c, m, t)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define cond_destroy(c)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define rwlock_init(l, a)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define rwlock_rdlock(l)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define rwlock_wrlock(l)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define rwlock_tryrdlock(l)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define rwlock_trywrlock(l)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define rwlock_unlock(l)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define rwlock_destroy(l)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define thr_keycreate(k, d)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define thr_setspecific(k, p)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define thr_getspecific(k)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define thr_keydelete(k)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define thr_once(o, f)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define thr_sigsetmask(f, n, o)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define thr_self()
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define thr_errno()
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define FLOCKFILE(fp)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define FUNLOCKFILE(fp)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#endif /* _REENTRANT */