/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _MTLIB_H
#define _MTLIB_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <thread.h>
#ifdef __cplusplus
extern "C" {
#endif
/* these are private to the library */
extern int primary_link_map;
extern void lmutex_lock(mutex_t *);
extern void lmutex_unlock(mutex_t *);
extern void lrw_rdlock(rwlock_t *);
extern void lrw_wrlock(rwlock_t *);
extern void lrw_unlock(rwlock_t *);
extern void sig_mutex_lock(mutex_t *);
extern void sig_mutex_unlock(mutex_t *);
extern int sig_mutex_trylock(mutex_t *);
extern void cancel_safe_mutex_lock(mutex_t *);
extern void cancel_safe_mutex_unlock(mutex_t *);
extern int cancel_safe_mutex_trylock(mutex_t *);
extern int cancel_active(void);
extern int _thrp_cancelled(void);
/* the private libc thread-safe allocator */
#if defined(THREAD_DEBUG)
extern void assert_no_libc_locks_held(void);
#else
#define assert_no_libc_locks_held()
#endif
/*
* Cheap check to tell if stdio needs to lock for MT progs.
* FUNLOCKFILE macros. __libc_threaded gets set to 1 when the first
* thread (beyond the main thread) is created in _thrp_create().
*/
extern int __libc_threaded;
{ \
else \
}
{ \
}
{ int r; \
r = (ret); \
FUNLOCKFILE(lk); \
return (r); \
}
#ifdef __cplusplus
}
#endif
#endif /* _MTLIB_H */