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.12 2006/04/06 13:03:09 davidxu 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>
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)
75 #define __predict_true(exp) (exp)
76 #define __predict_false(exp) (exp)
79 #ifdef _PTHREADS_INVARIANTS
80 #define THR_ASSERT(cond, msg) do { \
81 if (__predict_false(!(cond))) \
85 #define THR_ASSERT(cond, msg)
89 #define STATIC_LIB_REQUIRE(name)
91 #define STATIC_LIB_REQUIRE(name) __asm(".globl " #name)
94 TAILQ_HEAD(thread_head, pthread) thread_head;
95 TAILQ_HEAD(atfork_head, pthread_atfork) atfork_head;
97 #define TIMESPEC_ADD(dst, src, val) \
99 (dst)->tv_sec = (src)->tv_sec + (val)->tv_sec; \
100 (dst)->tv_nsec = (src)->tv_nsec + (val)->tv_nsec; \
101 if ((dst)->tv_nsec >= 1000000000) { \
103 (dst)->tv_nsec -= 1000000000; \
107 #define TIMESPEC_SUB(dst, src, val) \
109 (dst)->tv_sec = (src)->tv_sec - (val)->tv_sec; \
110 (dst)->tv_nsec = (src)->tv_nsec - (val)->tv_nsec; \
111 if ((dst)->tv_nsec < 0) { \
113 (dst)->tv_nsec += 1000000000; \
117 struct pthread_mutex {
119 * Lock for accesses to this structure.
121 volatile umtx_t m_lock;
122 enum pthread_mutextype m_type;
124 TAILQ_HEAD(mutex_head, pthread) m_queue;
125 struct pthread *m_owner;
131 * Used for priority inheritence and protection.
133 * m_prio - For priority inheritence, the highest active
134 * priority (threads locking the mutex inherit
135 * this priority). For priority protection, the
136 * ceiling priority of this mutex.
137 * m_saved_prio - mutex owners inherited priority before
138 * taking the mutex, restored when the owner
145 * Link for list of all mutexes a thread currently owns.
147 TAILQ_ENTRY(pthread_mutex) m_qe;
150 #define TAILQ_INITIALIZER { NULL, NULL }
152 #define PTHREAD_MUTEX_STATIC_INITIALIZER \
153 {0, PTHREAD_MUTEX_DEFAULT, PTHREAD_PRIO_NONE, TAILQ_INITIALIZER, \
154 NULL, { NULL }, MUTEX_FLAGS_PRIVATE, 0, 0, 0, TAILQ_INITIALIZER }
158 #define MUTEX_FLAGS_PRIVATE 0x01
159 #define MUTEX_FLAGS_INITED 0x02
160 #define MUTEX_FLAGS_BUSY 0x04
162 struct pthread_mutex_attr {
163 enum pthread_mutextype m_type;
169 #define PTHREAD_MUTEXATTR_STATIC_INITIALIZER \
170 { PTHREAD_MUTEX_DEFAULT, PTHREAD_PRIO_NONE, 0, MUTEX_FLAGS_PRIVATE }
172 struct pthread_cond {
174 * Lock for accesses to this structure.
176 volatile umtx_t c_lock;
177 volatile umtx_t c_seqno;
178 volatile int c_waiters;
179 volatile int c_wakeups;
184 struct pthread_cond_attr {
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 * Flags for condition variables.
207 #define COND_FLAGS_PRIVATE 0x01
208 #define COND_FLAGS_INITED 0x02
209 #define COND_FLAGS_BUSY 0x04
212 * Cleanup definitions.
214 struct pthread_cleanup {
215 struct pthread_cleanup *next;
216 void (*routine)(void *);
221 #define THR_CLEANUP_PUSH(td, func, arg) { \
222 struct pthread_cleanup __cup; \
224 __cup.routine = func; \
225 __cup.routine_arg = arg; \
227 __cup.next = (td)->cleanup; \
228 (td)->cleanup = &__cup;
230 #define THR_CLEANUP_POP(td, exec) \
231 (td)->cleanup = __cup.next; \
233 __cup.routine(__cup.routine_arg); \
236 struct pthread_atfork {
237 TAILQ_ENTRY(pthread_atfork) qe;
238 void (*prepare)(void);
239 void (*parent)(void);
243 struct pthread_attr {
249 #define THR_STACK_USER 0x100 /* 0xFF reserved for <pthread.h> */
252 void *stackaddr_attr;
253 size_t stacksize_attr;
254 size_t guardsize_attr;
258 * Thread creation state attributes.
260 #define THR_CREATE_RUNNING 0
261 #define THR_CREATE_SUSPENDED 1
264 * Miscellaneous definitions.
266 #define THR_STACK_DEFAULT (sizeof(void *) / 4 * 1024 * 1024)
269 * Maximum size of initial thread's stack. This perhaps deserves to be larger
270 * than the stacks of other threads, since many applications are likely to run
271 * almost entirely on this stack.
273 #define THR_STACK_INITIAL (THR_STACK_DEFAULT * 2)
276 * Define the different priority ranges. All applications have thread
277 * priorities constrained within 0-31. The threads library raises the
278 * priority when delivering signals in order to ensure that signal
279 * delivery happens (from the POSIX spec) "as soon as possible".
280 * In the future, the threads library will also be able to map specific
281 * threads into real-time (cooperating) processes or kernel threads.
282 * The RT and SIGNAL priorities will be used internally and added to
283 * thread base priorities so that the scheduling queue can handle both
284 * normal and RT priority threads with and without signal handling.
286 * The approach taken is that, within each class, signal delivery
287 * always has priority over thread execution.
289 #define THR_DEFAULT_PRIORITY 15
290 #define THR_MIN_PRIORITY 0
291 #define THR_MAX_PRIORITY 31 /* 0x1F */
292 #define THR_SIGNAL_PRIORITY 32 /* 0x20 */
293 #define THR_RT_PRIORITY 64 /* 0x40 */
294 #define THR_FIRST_PRIORITY THR_MIN_PRIORITY
295 #define THR_LAST_PRIORITY \
296 (THR_MAX_PRIORITY + THR_SIGNAL_PRIORITY + THR_RT_PRIORITY)
297 #define THR_BASE_PRIORITY(prio) ((prio) & THR_MAX_PRIORITY)
300 * Time slice period in microseconds.
302 #define TIMESLICE_USEC 20000
304 struct pthread_rwlockattr {
308 struct pthread_rwlock {
309 pthread_mutex_t lock; /* monitor lock */
310 pthread_cond_t read_signal;
311 pthread_cond_t write_signal;
312 int state; /* 0 = idle >0 = # of readers -1 = writer */
324 union pthread_wait_data {
325 pthread_mutex_t mutex;
328 struct pthread_specific_elem {
334 volatile int allocated;
337 void (*destructor)(void *);
345 * Magic value to help recognize a valid thread structure
346 * from an invalid one:
348 #define THR_MAGIC ((u_int32_t) 0xd09ba115)
351 u_int64_t uniqueid; /* for gdb */
354 * Lock for accesses to this thread structure.
358 /* Thread is terminated in kernel, written by kernel. */
361 /* Kernel thread id. */
364 /* Internal condition variable cycle number. */
367 /* How many low level locks the thread held. */
371 * Set to non-zero when this thread has entered a critical
372 * region. We allow for recursive entries into critical regions.
376 /* Signal blocked counter. */
379 /* Queue entry for list of all threads. */
380 TAILQ_ENTRY(pthread) tle; /* link for all threads in process */
382 /* Queue entry for GC lists. */
383 TAILQ_ENTRY(pthread) gcle;
385 /* Hash queue entry. */
386 LIST_ENTRY(pthread) hle;
388 /* Threads reference count. */
392 * Thread start routine, argument, stack pointer and thread
395 void *(*start_routine)(void *);
397 struct pthread_attr attr;
400 * Cancelability flags
402 #define THR_CANCEL_DISABLE 0x0001
403 #define THR_CANCEL_EXITING 0x0002
404 #define THR_CANCEL_AT_POINT 0x0004
405 #define THR_CANCEL_NEEDED 0x0008
406 #define SHOULD_CANCEL(val) \
407 (((val) & (THR_CANCEL_DISABLE | THR_CANCEL_EXITING | \
408 THR_CANCEL_NEEDED)) == THR_CANCEL_NEEDED)
410 #define SHOULD_ASYNC_CANCEL(val) \
411 (((val) & (THR_CANCEL_DISABLE | THR_CANCEL_EXITING | \
412 THR_CANCEL_NEEDED | THR_CANCEL_AT_POINT)) == \
413 (THR_CANCEL_NEEDED | THR_CANCEL_AT_POINT))
416 /* Thread temporary signal mask. */
423 * Error variable used instead of errno, used for internal.
428 * The joiner is the thread that is joining to this thread. The
429 * join status keeps track of a join operation to another thread.
431 struct pthread *joiner;
434 * The current thread can belong to a priority mutex queue.
435 * This is the synchronization queue link.
437 TAILQ_ENTRY(pthread) sqe;
440 union pthread_wait_data data;
442 /* Miscellaneous flags; only set with scheduling lock held. */
444 #define THR_FLAGS_PRIVATE 0x0001
445 #define THR_FLAGS_NEED_SUSPEND 0x0002 /* thread should be suspended */
446 #define THR_FLAGS_SUSPENDED 0x0004 /* thread is suspended */
448 /* Thread list flags; only set with thread list lock held. */
450 #define TLFLAGS_GC_SAFE 0x0001 /* thread safe for cleaning */
451 #define TLFLAGS_IN_TDLIST 0x0002 /* thread in all thread list */
452 #define TLFLAGS_IN_GCLIST 0x0004 /* thread in gc list */
453 #define TLFLAGS_DETACHED 0x0008 /* thread is detached */
456 * Base priority is the user setable and retrievable priority
457 * of the thread. It is only affected by explicit calls to
458 * set thread priority and upon thread creation via a thread
459 * attribute or default priority.
464 * Inherited priority is the priority a thread inherits by
465 * taking a priority inheritence or protection mutex. It
466 * is not affected by base priority changes. Inherited
467 * priority defaults to and remains 0 until a mutex is taken
468 * that is being waited on by any other thread whose priority
471 char inherited_priority;
474 * Active priority is always the maximum of the threads base
475 * priority and inherited priority. When there is a change
476 * in either the base or inherited priority, the active
477 * priority must be recalculated.
479 char active_priority;
481 /* Number of priority ceiling or protection mutexes owned. */
482 int priority_mutex_count;
484 /* Queue of currently owned simple type mutexes. */
485 TAILQ_HEAD(, pthread_mutex) mutexq;
488 struct pthread_specific_elem *specific;
489 int specific_data_count;
491 /* Number rwlocks rdlocks held. */
495 * Current locks bitmap for rtld. */
498 /* Thread control block */
501 /* Cleanup handlers Link List */
502 struct pthread_cleanup *cleanup;
504 /* Enable event reporting */
508 td_thr_events_t event_mask;
511 td_event_msg_t event_buf;
514 #define THR_IN_CRITICAL(thrd) \
515 (((thrd)->locklevel > 0) || \
516 ((thrd)->critical_count > 0))
518 #define THR_UMTX_TRYLOCK(thrd, lck) \
519 _thr_umtx_trylock((lck), (thrd)->tid)
521 #define THR_UMTX_LOCK(thrd, lck) \
522 _thr_umtx_lock((lck), (thrd)->tid)
524 #define THR_UMTX_TIMEDLOCK(thrd, lck, timo) \
525 _thr_umtx_timedlock((lck), (thrd)->tid, (timo))
527 #define THR_UMTX_UNLOCK(thrd, lck) \
528 _thr_umtx_unlock((lck), (thrd)->tid)
530 #define THR_LOCK_ACQUIRE(thrd, lck) \
532 (thrd)->locklevel++; \
533 _thr_umtx_lock((lck), (thrd)->tid); \
536 #ifdef _PTHREADS_INVARIANTS
537 #define THR_ASSERT_LOCKLEVEL(thrd) \
539 if (__predict_false((thrd)->locklevel <= 0)) \
540 _thr_assert_lock_level(); \
543 #define THR_ASSERT_LOCKLEVEL(thrd)
546 #define THR_LOCK_RELEASE(thrd, lck) \
548 THR_ASSERT_LOCKLEVEL(thrd); \
549 _thr_umtx_unlock((lck), (thrd)->tid); \
550 (thrd)->locklevel--; \
554 #define THR_LOCK(curthrd) THR_LOCK_ACQUIRE(curthrd, &(curthrd)->lock)
555 #define THR_UNLOCK(curthrd) THR_LOCK_RELEASE(curthrd, &(curthrd)->lock)
556 #define THR_THREAD_LOCK(curthrd, thr) THR_LOCK_ACQUIRE(curthrd, &(thr)->lock)
557 #define THR_THREAD_UNLOCK(curthrd, thr) THR_LOCK_RELEASE(curthrd, &(thr)->lock)
559 #define THREAD_LIST_LOCK(curthrd) \
561 THR_LOCK_ACQUIRE((curthrd), &_thr_list_lock); \
564 #define THREAD_LIST_UNLOCK(curthrd) \
566 THR_LOCK_RELEASE((curthrd), &_thr_list_lock); \
570 * Macros to insert/remove threads to the all thread list and
573 #define THR_LIST_ADD(thrd) do { \
574 if (((thrd)->tlflags & TLFLAGS_IN_TDLIST) == 0) { \
575 TAILQ_INSERT_HEAD(&_thread_list, thrd, tle); \
576 _thr_hash_add(thrd); \
577 (thrd)->tlflags |= TLFLAGS_IN_TDLIST; \
580 #define THR_LIST_REMOVE(thrd) do { \
581 if (((thrd)->tlflags & TLFLAGS_IN_TDLIST) != 0) { \
582 TAILQ_REMOVE(&_thread_list, thrd, tle); \
583 _thr_hash_remove(thrd); \
584 (thrd)->tlflags &= ~TLFLAGS_IN_TDLIST; \
587 #define THR_GCLIST_ADD(thrd) do { \
588 if (((thrd)->tlflags & TLFLAGS_IN_GCLIST) == 0) { \
589 TAILQ_INSERT_HEAD(&_thread_gc_list, thrd, gcle);\
590 (thrd)->tlflags |= TLFLAGS_IN_GCLIST; \
594 #define THR_GCLIST_REMOVE(thrd) do { \
595 if (((thrd)->tlflags & TLFLAGS_IN_GCLIST) != 0) { \
596 TAILQ_REMOVE(&_thread_gc_list, thrd, gcle); \
597 (thrd)->tlflags &= ~TLFLAGS_IN_GCLIST; \
602 #define GC_NEEDED() (_thr_gc_count >= 5)
604 #define THR_IN_SYNCQ(thrd) (((thrd)->sflags & THR_FLAGS_IN_SYNCQ) != 0)
606 #define SHOULD_REPORT_EVENT(curthr, e) \
607 (curthr->report_events && \
608 (((curthr)->event_mask | _thread_event_mask ) & e) != 0)
610 extern int __isthreaded;
613 * Global variables for the pthread library.
615 extern char *_usrstack;
616 extern struct pthread *_thr_initial;
617 extern int _thread_scope_system;
620 extern int _libthread_xu_debug;
621 extern int _thread_event_mask;
622 extern struct pthread *_thread_last_event;
624 /* List of all threads */
625 extern struct thread_head _thread_list;
627 /* List of threads needing GC */
628 extern struct thread_head _thread_gc_list;
630 extern int _thread_active_threads;
632 extern struct atfork_head _thr_atfork_list;
633 extern umtx_t _thr_atfork_lock;
635 /* Default thread attributes */
636 extern struct pthread_attr _pthread_attr_default;
638 /* Default mutex attributes */
639 extern struct pthread_mutex_attr _pthread_mutexattr_default;
641 /* Default condition variable attributes */
642 extern struct pthread_cond_attr _pthread_condattr_default;
644 extern pid_t _thr_pid;
645 extern size_t _thr_guard_default;
646 extern size_t _thr_stack_default;
647 extern size_t _thr_stack_initial;
648 extern int _thr_page_size;
649 extern int _thr_gc_count;
651 extern umtx_t _mutex_static_lock;
652 extern umtx_t _cond_static_lock;
653 extern umtx_t _rwlock_static_lock;
654 extern umtx_t _keytable_lock;
655 extern umtx_t _thr_list_lock;
656 extern umtx_t _thr_event_lock;
659 * Function prototype definitions.
662 int _thr_setthreaded(int);
663 int _mutex_cv_lock(pthread_mutex_t *);
664 int _mutex_cv_unlock(pthread_mutex_t *);
665 void _mutex_notify_priochange(struct pthread *, struct pthread *, int);
666 int _mutex_reinit(pthread_mutex_t *);
667 void _mutex_fork(struct pthread *curthread);
668 void _mutex_unlock_private(struct pthread *);
669 void _libpthread_init(struct pthread *);
670 struct pthread *_thr_alloc(struct pthread *);
671 void _thread_exit(const char *, int, const char *) __dead2;
672 void _thr_exit_cleanup(void);
673 int _thr_ref_add(struct pthread *, struct pthread *, int);
674 void _thr_ref_delete(struct pthread *, struct pthread *);
675 void _thr_ref_delete_unlocked(struct pthread *, struct pthread *);
676 int _thr_find_thread(struct pthread *, struct pthread *, int);
677 void _thr_rtld_init(void);
678 void _thr_rtld_fini(void);
679 int _thr_stack_alloc(struct pthread_attr *);
680 void _thr_stack_free(struct pthread_attr *);
681 void _thr_free(struct pthread *, struct pthread *);
682 void _thr_gc(struct pthread *);
683 void _thread_cleanupspecific(void);
684 void _thread_dump_info(void);
685 void _thread_printf(int, const char *, ...);
686 void _thr_spinlock_init(void);
687 int _thr_cancel_enter(struct pthread *);
688 void _thr_cancel_leave(struct pthread *, int);
689 void _thr_signal_block(struct pthread *);
690 void _thr_signal_unblock(struct pthread *);
691 void _thr_signal_init(void);
692 void _thr_signal_deinit(void);
693 int _thr_send_sig(struct pthread *, int sig);
694 void _thr_list_init(void);
695 void _thr_hash_add(struct pthread *);
696 void _thr_hash_remove(struct pthread *);
697 struct pthread *_thr_hash_find(struct pthread *);
698 void _thr_link(struct pthread *curthread, struct pthread *thread);
699 void _thr_unlink(struct pthread *curthread, struct pthread *thread);
700 void _thr_suspend_check(struct pthread *curthread);
701 void _thr_assert_lock_level(void) __dead2;
702 void _thr_ast(struct pthread *);
703 int _thr_get_tid(void);
704 void _thr_report_creation(struct pthread *curthread,
705 struct pthread *newthread);
706 void _thr_report_death(struct pthread *curthread);
707 void _thread_bp_create(void);
708 void _thread_bp_death(void);
710 /* #include <sys/aio.h> */
712 int __sys_aio_suspend(const struct aiocb * const[], int, const struct timespec *);
715 /* #include <fcntl.h> */
717 int __sys_fcntl(int, int, ...);
718 int __sys_open(const char *, int, ...);
721 /* #include <sys/ioctl.h> */
723 int __sys_ioctl(int, unsigned long, ...);
726 /* #inclde <sched.h> */
728 int __sys_sched_yield(void);
731 /* #include <signal.h> */
733 int __sys_kill(pid_t, int);
734 int __sys_sigaction(int, const struct sigaction *, struct sigaction *);
735 int __sys_sigpending(sigset_t *);
736 int __sys_sigprocmask(int, const sigset_t *, sigset_t *);
737 int __sys_sigsuspend(const sigset_t *);
738 int __sys_sigreturn(ucontext_t *);
739 int __sys_sigaltstack(const struct sigaltstack *, struct sigaltstack *);
742 /* #include <sys/socket.h> */
743 #ifdef _SYS_SOCKET_H_
744 int __sys_accept(int, struct sockaddr *, socklen_t *);
745 int __sys_connect(int, const struct sockaddr *, socklen_t);
746 ssize_t __sys_recv(int, void *, size_t, int);
747 ssize_t __sys_recvfrom(int, void *, size_t, int, struct sockaddr *, socklen_t *);
748 ssize_t __sys_recvmsg(int, struct msghdr *, int);
749 int __sys_sendfile(int, int, off_t, size_t, struct sf_hdtr *,
751 ssize_t __sys_sendmsg(int, const struct msghdr *, int);
752 ssize_t __sys_sendto(int, const void *,size_t, int, const struct sockaddr *, socklen_t);
755 /* #include <sys/uio.h> */
757 ssize_t __sys_readv(int, const struct iovec *, int);
758 ssize_t __sys_writev(int, const struct iovec *, int);
761 /* #include <time.h> */
763 int __sys_nanosleep(const struct timespec *, struct timespec *);
766 /* #include <unistd.h> */
768 int __sys_close(int);
769 int __sys_execve(const char *, char * const *, char * const *);
770 int __sys_fork(void);
771 int __sys_fsync(int);
772 pid_t __sys_getpid(void);
773 int __sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
774 ssize_t __sys_read(int, void *, size_t);
775 ssize_t __sys_write(int, const void *, size_t);
776 void __sys_exit(int);
777 int __sys_sigwait(const sigset_t *, int *);
778 int __sys_sigtimedwait(const sigset_t *, siginfo_t *,
779 const struct timespec *);
780 int __sys_sigwaitinfo(const sigset_t *set, siginfo_t *info);
783 /* #include <poll.h> */
785 int __sys_poll(struct pollfd *, unsigned, int);
788 /* #include <sys/mman.h> */
790 int __sys_msync(void *, size_t, int);
794 _thr_isthreaded(void)
796 return (__isthreaded != 0);
802 return (_thr_initial != 0);
806 _thr_check_init(void)
808 if (_thr_initial == 0)
814 #endif /* !_THR_PRIVATE_H */