2 * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by John Birrell.
16 * 4. Neither the name of the author nor the names of any co-contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * Private thread definitions for the uthread kernel.
34 * $FreeBSD: src/lib/libpthread/thread/thr_private.h,v 1.120 2004/11/01 10:49:34 davidxu Exp $
35 * $DragonFly: src/lib/libthread_xu/thread/thr_private.h,v 1.18 2008/04/14 20:12:41 dillon Exp $
38 #ifndef _THR_PRIVATE_H
39 #define _THR_PRIVATE_H
44 #include <sys/types.h>
46 #include <sys/cdefs.h>
47 #include <sys/queue.h>
48 #include <machine/atomic.h>
53 #include <sys/sched.h>
56 #include <pthread_np.h>
58 #include "pthread_md.h"
60 #include "thread_db.h"
62 /* Signal to do cancellation */
66 * Kernel fatal error handler macro.
68 #define PANIC(string) _thread_exit(__FILE__,__LINE__,string)
70 /* Output debug messages like this: */
71 #define stdout_debug(args...) _thread_printf(STDOUT_FILENO, ##args)
72 #define stderr_debug(args...) _thread_printf(STDOUT_FILENO, ##args)
74 #ifdef _PTHREADS_INVARIANTS
75 #define THR_ASSERT(cond, msg) do { \
76 if (__predict_false(!(cond))) \
80 #define THR_ASSERT(cond, msg)
84 #define STATIC_LIB_REQUIRE(name)
86 #define STATIC_LIB_REQUIRE(name) __asm(".globl " #name)
89 TAILQ_HEAD(thread_head, pthread) thread_head;
90 TAILQ_HEAD(atfork_head, pthread_atfork) atfork_head;
92 #define TIMESPEC_ADD(dst, src, val) \
94 (dst)->tv_sec = (src)->tv_sec + (val)->tv_sec; \
95 (dst)->tv_nsec = (src)->tv_nsec + (val)->tv_nsec; \
96 if ((dst)->tv_nsec >= 1000000000) { \
98 (dst)->tv_nsec -= 1000000000; \
102 #define TIMESPEC_SUB(dst, src, val) \
104 (dst)->tv_sec = (src)->tv_sec - (val)->tv_sec; \
105 (dst)->tv_nsec = (src)->tv_nsec - (val)->tv_nsec; \
106 if ((dst)->tv_nsec < 0) { \
108 (dst)->tv_nsec += 1000000000; \
112 struct pthread_mutex {
114 * Lock for accesses to this structure.
116 volatile umtx_t m_lock;
117 enum pthread_mutextype m_type;
119 TAILQ_HEAD(mutex_head, pthread) m_queue;
120 struct pthread *m_owner;
126 * Used for priority inheritence and protection.
128 * m_prio - For priority inheritence, the highest active
129 * priority (threads locking the mutex inherit
130 * this priority). For priority protection, the
131 * ceiling priority of this mutex.
132 * m_saved_prio - mutex owners inherited priority before
133 * taking the mutex, restored when the owner
140 * Link for list of all mutexes a thread currently owns.
142 TAILQ_ENTRY(pthread_mutex) m_qe;
145 #define TAILQ_INITIALIZER { NULL, NULL }
147 #define PTHREAD_MUTEX_STATIC_INITIALIZER \
148 {0, PTHREAD_MUTEX_DEFAULT, PTHREAD_PRIO_NONE, TAILQ_INITIALIZER, \
149 NULL, { NULL }, MUTEX_FLAGS_PRIVATE, 0, 0, 0, TAILQ_INITIALIZER }
153 #define MUTEX_FLAGS_PRIVATE 0x01
154 #define MUTEX_FLAGS_INITED 0x02
156 struct pthread_mutex_attr {
157 enum pthread_mutextype m_type;
163 #define PTHREAD_MUTEXATTR_STATIC_INITIALIZER \
164 { PTHREAD_MUTEX_DEFAULT, PTHREAD_PRIO_NONE, 0, MUTEX_FLAGS_PRIVATE }
166 struct pthread_cond {
168 * Lock for accesses to this structure.
170 volatile umtx_t c_lock;
171 volatile umtx_t c_seqno;
172 volatile int c_waiters;
173 volatile int c_broadcast;
178 struct pthread_cond_attr {
184 * Flags for condition variables.
186 #define COND_FLAGS_PRIVATE 0x01
187 #define COND_FLAGS_INITED 0x02
189 struct pthread_barrier {
190 volatile umtx_t b_lock;
191 volatile umtx_t b_cycle;
192 volatile int b_count;
193 volatile int b_waiters;
196 struct pthread_barrierattr {
200 struct pthread_spinlock {
201 volatile umtx_t s_lock;
205 * Cleanup definitions.
207 struct pthread_cleanup {
208 struct pthread_cleanup *next;
209 void (*routine)(void *);
214 #define THR_CLEANUP_PUSH(td, func, arg) { \
215 struct pthread_cleanup __cup; \
217 __cup.routine = func; \
218 __cup.routine_arg = arg; \
220 __cup.next = (td)->cleanup; \
221 (td)->cleanup = &__cup;
223 #define THR_CLEANUP_POP(td, exec) \
224 (td)->cleanup = __cup.next; \
226 __cup.routine(__cup.routine_arg); \
229 struct pthread_atfork {
230 TAILQ_ENTRY(pthread_atfork) qe;
231 void (*prepare)(void);
232 void (*parent)(void);
236 struct pthread_attr {
241 #define THR_STACK_USER 0x100 /* 0xFF reserved for <pthread.h> */
243 void *stackaddr_attr;
244 size_t stacksize_attr;
245 size_t guardsize_attr;
249 * Thread creation state attributes.
251 #define THR_CREATE_RUNNING 0
252 #define THR_CREATE_SUSPENDED 1
255 * Miscellaneous definitions.
257 #define THR_STACK_DEFAULT (sizeof(void *) / 4 * 1024 * 1024)
260 * Maximum size of initial thread's stack. This perhaps deserves to be larger
261 * than the stacks of other threads, since many applications are likely to run
262 * almost entirely on this stack.
264 #define THR_STACK_INITIAL (THR_STACK_DEFAULT * 2)
267 * Define the different priority ranges. All applications have thread
268 * priorities constrained within 0-31. The threads library raises the
269 * priority when delivering signals in order to ensure that signal
270 * delivery happens (from the POSIX spec) "as soon as possible".
271 * In the future, the threads library will also be able to map specific
272 * threads into real-time (cooperating) processes or kernel threads.
273 * The RT and SIGNAL priorities will be used internally and added to
274 * thread base priorities so that the scheduling queue can handle both
275 * normal and RT priority threads with and without signal handling.
277 * The approach taken is that, within each class, signal delivery
278 * always has priority over thread execution.
280 #define THR_DEFAULT_PRIORITY 15
281 #define THR_MIN_PRIORITY 0
282 #define THR_MAX_PRIORITY 31 /* 0x1F */
283 #define THR_SIGNAL_PRIORITY 32 /* 0x20 */
284 #define THR_RT_PRIORITY 64 /* 0x40 */
285 #define THR_FIRST_PRIORITY THR_MIN_PRIORITY
286 #define THR_LAST_PRIORITY \
287 (THR_MAX_PRIORITY + THR_SIGNAL_PRIORITY + THR_RT_PRIORITY)
288 #define THR_BASE_PRIORITY(prio) ((prio) & THR_MAX_PRIORITY)
291 * Time slice period in microseconds.
293 #define TIMESLICE_USEC 20000
295 struct pthread_rwlockattr {
299 struct pthread_rwlock {
300 pthread_mutex_t lock; /* monitor lock */
301 pthread_cond_t read_signal;
302 pthread_cond_t write_signal;
303 int state; /* 0 = idle >0 = # of readers -1 = writer */
315 struct pthread_specific_elem {
321 volatile int allocated;
324 void (*destructor)(void *);
332 * Magic value to help recognize a valid thread structure
333 * from an invalid one:
335 #define THR_MAGIC ((u_int32_t) 0xd09ba115)
338 u_int64_t uniqueid; /* for gdb */
341 * Lock for accesses to this thread structure.
345 /* Thread is terminated in kernel, written by kernel. */
348 /* Kernel thread id. */
351 /* Internal condition variable cycle number. */
354 /* How many low level locks the thread held. */
358 * Set to non-zero when this thread has entered a critical
359 * region. We allow for recursive entries into critical regions.
363 /* Signal blocked counter. */
366 /* Queue entry for list of all threads. */
367 TAILQ_ENTRY(pthread) tle; /* link for all threads in process */
369 /* Queue entry for GC lists. */
370 TAILQ_ENTRY(pthread) gcle;
372 /* Hash queue entry. */
373 LIST_ENTRY(pthread) hle;
375 /* Threads reference count. */
379 * Thread start routine, argument, stack pointer and thread
382 void *(*start_routine)(void *);
384 struct pthread_attr attr;
387 * Cancelability flags
389 #define THR_CANCEL_DISABLE 0x0001
390 #define THR_CANCEL_EXITING 0x0002
391 #define THR_CANCEL_AT_POINT 0x0004
392 #define THR_CANCEL_NEEDED 0x0008
393 #define SHOULD_CANCEL(val) \
394 (((val) & (THR_CANCEL_DISABLE | THR_CANCEL_EXITING | \
395 THR_CANCEL_NEEDED)) == THR_CANCEL_NEEDED)
397 #define SHOULD_ASYNC_CANCEL(val) \
398 (((val) & (THR_CANCEL_DISABLE | THR_CANCEL_EXITING | \
399 THR_CANCEL_NEEDED | THR_CANCEL_AT_POINT)) == \
400 (THR_CANCEL_NEEDED | THR_CANCEL_AT_POINT))
403 /* Thread temporary signal mask. */
410 * Error variable used instead of errno, used for internal.
415 * The joiner is the thread that is joining to this thread. The
416 * join status keeps track of a join operation to another thread.
418 struct pthread *joiner;
421 * The current thread can belong to a priority mutex queue.
422 * This is the synchronization queue link.
424 TAILQ_ENTRY(pthread) sqe;
426 /* Miscellaneous flags; only set with scheduling lock held. */
428 #define THR_FLAGS_PRIVATE 0x0001
429 #define THR_FLAGS_NEED_SUSPEND 0x0002 /* thread should be suspended */
430 #define THR_FLAGS_SUSPENDED 0x0004 /* thread is suspended */
432 /* Thread list flags; only set with thread list lock held. */
434 #define TLFLAGS_GC_SAFE 0x0001 /* thread safe for cleaning */
435 #define TLFLAGS_IN_TDLIST 0x0002 /* thread in all thread list */
436 #define TLFLAGS_IN_GCLIST 0x0004 /* thread in gc list */
437 #define TLFLAGS_DETACHED 0x0008 /* thread is detached */
440 * Base priority is the user setable and retrievable priority
441 * of the thread. It is only affected by explicit calls to
442 * set thread priority and upon thread creation via a thread
443 * attribute or default priority.
448 * Inherited priority is the priority a thread inherits by
449 * taking a priority inheritence or protection mutex. It
450 * is not affected by base priority changes. Inherited
451 * priority defaults to and remains 0 until a mutex is taken
452 * that is being waited on by any other thread whose priority
455 char inherited_priority;
458 * Active priority is always the maximum of the threads base
459 * priority and inherited priority. When there is a change
460 * in either the base or inherited priority, the active
461 * priority must be recalculated.
463 char active_priority;
465 /* Number of priority ceiling or protection mutexes owned. */
466 int priority_mutex_count;
468 /* Queue of currently owned simple type mutexes. */
469 TAILQ_HEAD(, pthread_mutex) mutexq;
472 struct pthread_specific_elem *specific;
473 int specific_data_count;
475 /* Number rwlocks rdlocks held. */
479 * Current locks bitmap for rtld. */
482 /* Thread control block */
485 /* Cleanup handlers Link List */
486 struct pthread_cleanup *cleanup;
488 /* Enable event reporting */
492 td_thr_events_t event_mask;
495 td_event_msg_t event_buf;
498 #define THR_IN_CRITICAL(thrd) \
499 (((thrd)->locklevel > 0) || \
500 ((thrd)->critical_count > 0))
502 #define THR_UMTX_TRYLOCK(thrd, lck) \
503 _thr_umtx_trylock((lck), (thrd)->tid)
505 #define THR_UMTX_LOCK(thrd, lck) \
506 _thr_umtx_lock((lck), (thrd)->tid)
508 #define THR_UMTX_TIMEDLOCK(thrd, lck, timo) \
509 _thr_umtx_timedlock((lck), (thrd)->tid, (timo))
511 #define THR_UMTX_UNLOCK(thrd, lck) \
512 _thr_umtx_unlock((lck), (thrd)->tid)
514 #define THR_LOCK_ACQUIRE(thrd, lck) \
516 (thrd)->locklevel++; \
517 _thr_umtx_lock((lck), (thrd)->tid); \
520 #ifdef _PTHREADS_INVARIANTS
521 #define THR_ASSERT_LOCKLEVEL(thrd) \
523 if (__predict_false((thrd)->locklevel <= 0)) \
524 _thr_assert_lock_level(); \
527 #define THR_ASSERT_LOCKLEVEL(thrd)
530 #define THR_LOCK_RELEASE(thrd, lck) \
532 THR_ASSERT_LOCKLEVEL(thrd); \
533 _thr_umtx_unlock((lck), (thrd)->tid); \
534 (thrd)->locklevel--; \
538 #define THR_LOCK(curthrd) THR_LOCK_ACQUIRE(curthrd, &(curthrd)->lock)
539 #define THR_UNLOCK(curthrd) THR_LOCK_RELEASE(curthrd, &(curthrd)->lock)
540 #define THR_THREAD_LOCK(curthrd, thr) THR_LOCK_ACQUIRE(curthrd, &(thr)->lock)
541 #define THR_THREAD_UNLOCK(curthrd, thr) THR_LOCK_RELEASE(curthrd, &(thr)->lock)
543 #define THREAD_LIST_LOCK(curthrd) \
545 THR_LOCK_ACQUIRE((curthrd), &_thr_list_lock); \
548 #define THREAD_LIST_UNLOCK(curthrd) \
550 THR_LOCK_RELEASE((curthrd), &_thr_list_lock); \
554 * Macros to insert/remove threads to the all thread list and
557 #define THR_LIST_ADD(thrd) do { \
558 if (((thrd)->tlflags & TLFLAGS_IN_TDLIST) == 0) { \
559 TAILQ_INSERT_HEAD(&_thread_list, thrd, tle); \
560 _thr_hash_add(thrd); \
561 (thrd)->tlflags |= TLFLAGS_IN_TDLIST; \
564 #define THR_LIST_REMOVE(thrd) do { \
565 if (((thrd)->tlflags & TLFLAGS_IN_TDLIST) != 0) { \
566 TAILQ_REMOVE(&_thread_list, thrd, tle); \
567 _thr_hash_remove(thrd); \
568 (thrd)->tlflags &= ~TLFLAGS_IN_TDLIST; \
571 #define THR_GCLIST_ADD(thrd) do { \
572 if (((thrd)->tlflags & TLFLAGS_IN_GCLIST) == 0) { \
573 TAILQ_INSERT_HEAD(&_thread_gc_list, thrd, gcle);\
574 (thrd)->tlflags |= TLFLAGS_IN_GCLIST; \
578 #define THR_GCLIST_REMOVE(thrd) do { \
579 if (((thrd)->tlflags & TLFLAGS_IN_GCLIST) != 0) { \
580 TAILQ_REMOVE(&_thread_gc_list, thrd, gcle); \
581 (thrd)->tlflags &= ~TLFLAGS_IN_GCLIST; \
586 #define GC_NEEDED() (_thr_gc_count >= 5)
588 #define THR_IN_SYNCQ(thrd) (((thrd)->sflags & THR_FLAGS_IN_SYNCQ) != 0)
590 #define SHOULD_REPORT_EVENT(curthr, e) \
591 (curthr->report_events && \
592 (((curthr)->event_mask | _thread_event_mask ) & e) != 0)
594 extern int __isthreaded;
597 * Global variables for the pthread library.
599 extern char *_usrstack;
600 extern struct pthread *_thr_initial;
601 extern int _thread_scope_system;
604 extern int _libthread_xu_debug;
605 extern int _thread_event_mask;
606 extern struct pthread *_thread_last_event;
608 /* List of all threads */
609 extern struct thread_head _thread_list;
611 /* List of threads needing GC */
612 extern struct thread_head _thread_gc_list;
614 extern int _thread_active_threads;
616 extern struct atfork_head _thr_atfork_list;
617 extern umtx_t _thr_atfork_lock;
619 /* Default thread attributes */
620 extern struct pthread_attr _pthread_attr_default;
622 /* Default mutex attributes */
623 extern struct pthread_mutex_attr _pthread_mutexattr_default;
625 /* Default condition variable attributes */
626 extern struct pthread_cond_attr _pthread_condattr_default;
628 extern pid_t _thr_pid;
629 extern size_t _thr_guard_default;
630 extern size_t _thr_stack_default;
631 extern size_t _thr_stack_initial;
632 extern int _thr_page_size;
633 extern int _thr_gc_count;
635 extern umtx_t _mutex_static_lock;
636 extern umtx_t _cond_static_lock;
637 extern umtx_t _rwlock_static_lock;
638 extern umtx_t _keytable_lock;
639 extern umtx_t _thr_list_lock;
640 extern umtx_t _thr_event_lock;
643 * Function prototype definitions.
646 int _thr_setthreaded(int);
647 int _mutex_cv_lock(pthread_mutex_t *, int count);
648 int _mutex_cv_unlock(pthread_mutex_t *, int *count);
649 void _mutex_notify_priochange(struct pthread *, struct pthread *, int);
650 int _mutex_reinit(pthread_mutex_t *);
651 void _mutex_fork(struct pthread *curthread);
652 void _mutex_unlock_private(struct pthread *);
653 void _libpthread_init(struct pthread *);
654 struct pthread *_thr_alloc(struct pthread *);
655 void _thread_exit(const char *, int, const char *) __dead2;
656 void _thr_exit_cleanup(void);
657 int _thr_ref_add(struct pthread *, struct pthread *, int);
658 void _thr_ref_delete(struct pthread *, struct pthread *);
659 void _thr_ref_delete_unlocked(struct pthread *, struct pthread *);
660 int _thr_find_thread(struct pthread *, struct pthread *, int);
661 void _thr_rtld_init(void);
662 void _thr_rtld_fini(void);
663 int _thr_stack_alloc(struct pthread_attr *);
664 void _thr_stack_free(struct pthread_attr *);
665 void _thr_free(struct pthread *, struct pthread *);
666 void _thr_gc(struct pthread *);
667 void _thread_cleanupspecific(void);
668 void _thread_dump_info(void);
669 void _thread_printf(int, const char *, ...);
670 void _thr_spinlock_init(void);
671 int _thr_cancel_enter(struct pthread *);
672 void _thr_cancel_leave(struct pthread *, int);
673 void _thr_signal_block(struct pthread *);
674 void _thr_signal_unblock(struct pthread *);
675 void _thr_signal_init(void);
676 void _thr_signal_deinit(void);
677 int _thr_send_sig(struct pthread *, int sig);
678 void _thr_list_init(void);
679 void _thr_hash_add(struct pthread *);
680 void _thr_hash_remove(struct pthread *);
681 struct pthread *_thr_hash_find(struct pthread *);
682 void _thr_link(struct pthread *curthread, struct pthread *thread);
683 void _thr_unlink(struct pthread *curthread, struct pthread *thread);
684 void _thr_suspend_check(struct pthread *curthread);
685 void _thr_assert_lock_level(void) __dead2;
686 void _thr_ast(struct pthread *);
687 int _thr_get_tid(void);
688 void _thr_report_creation(struct pthread *curthread,
689 struct pthread *newthread);
690 void _thr_report_death(struct pthread *curthread);
691 void _thread_bp_create(void);
692 void _thread_bp_death(void);
693 int _thr_getscheduler(lwpid_t, int *, struct sched_param *);
694 int _thr_setscheduler(lwpid_t, int, const struct sched_param *);
695 int _thr_set_sched_other_prio(struct pthread *, int);
697 /* #include <sys/aio.h> */
699 int __sys_aio_suspend(const struct aiocb * const[], int, const struct timespec *);
702 /* #include <fcntl.h> */
704 int __sys_fcntl(int, int, ...);
705 int __sys_open(const char *, int, ...);
708 /* #include <sys/ioctl.h> */
710 int __sys_ioctl(int, unsigned long, ...);
713 /* #inclde <sched.h> */
715 int __sys_sched_yield(void);
718 /* #include <signal.h> */
720 int __sys_kill(pid_t, int);
721 int __sys_sigaction(int, const struct sigaction *, struct sigaction *);
722 int __sys_sigpending(sigset_t *);
723 int __sys_sigprocmask(int, const sigset_t *, sigset_t *);
724 int __sys_sigsuspend(const sigset_t *);
725 int __sys_sigreturn(ucontext_t *);
726 int __sys_sigaltstack(const struct sigaltstack *, struct sigaltstack *);
729 /* #include <sys/socket.h> */
730 #ifdef _SYS_SOCKET_H_
731 int __sys_accept(int, struct sockaddr *, socklen_t *);
732 int __sys_connect(int, const struct sockaddr *, socklen_t);
733 ssize_t __sys_recv(int, void *, size_t, int);
734 ssize_t __sys_recvfrom(int, void *, size_t, int, struct sockaddr *, socklen_t *);
735 ssize_t __sys_recvmsg(int, struct msghdr *, int);
736 int __sys_sendfile(int, int, off_t, size_t, struct sf_hdtr *,
738 ssize_t __sys_sendmsg(int, const struct msghdr *, int);
739 ssize_t __sys_sendto(int, const void *,size_t, int, const struct sockaddr *, socklen_t);
742 /* #include <sys/uio.h> */
744 ssize_t __sys_readv(int, const struct iovec *, int);
745 ssize_t __sys_writev(int, const struct iovec *, int);
748 /* #include <time.h> */
750 int __sys_nanosleep(const struct timespec *, struct timespec *);
753 /* #include <unistd.h> */
755 int __sys_close(int);
756 int __sys_execve(const char *, char * const *, char * const *);
757 int __sys_fork(void);
758 int __sys_fsync(int);
759 pid_t __sys_getpid(void);
760 int __sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
761 ssize_t __sys_read(int, void *, size_t);
762 ssize_t __sys_write(int, const void *, size_t);
763 void __sys_exit(int);
764 int __sys_sigwait(const sigset_t *, int *);
765 int __sys_sigtimedwait(const sigset_t *, siginfo_t *,
766 const struct timespec *);
767 int __sys_sigwaitinfo(const sigset_t *set, siginfo_t *info);
770 /* #include <poll.h> */
772 int __sys_poll(struct pollfd *, unsigned, int);
775 /* #include <sys/mman.h> */
777 int __sys_msync(void *, size_t, int);
781 _thr_isthreaded(void)
783 return (__isthreaded != 0);
789 return (_thr_initial != 0);
793 _thr_check_init(void)
795 if (_thr_initial == 0)
801 #endif /* !_THR_PRIVATE_H */