xref: /freebsd/include/pthread_np.h (revision b3e7694832e81d7a904a10f525f8797b753bf0d3)
12321c474SPedro F. Giffuni /*-
22321c474SPedro F. Giffuni  * SPDX-License-Identifier: BSD-3-Clause
32321c474SPedro F. Giffuni  *
41c1426e1SJohn Birrell  * Copyright (c) 1996-98 John Birrell <jb@cimlogic.com.au>.
50f7d6847SJulian Elischer  * All rights reserved.
60f7d6847SJulian Elischer  *
70f7d6847SJulian Elischer  * Redistribution and use in source and binary forms, with or without
80f7d6847SJulian Elischer  * modification, are permitted provided that the following conditions
90f7d6847SJulian Elischer  * are met:
100f7d6847SJulian Elischer  * 1. Redistributions of source code must retain the above copyright
110f7d6847SJulian Elischer  *    notice, this list of conditions and the following disclaimer.
120f7d6847SJulian Elischer  * 2. Redistributions in binary form must reproduce the above copyright
130f7d6847SJulian Elischer  *    notice, this list of conditions and the following disclaimer in the
140f7d6847SJulian Elischer  *    documentation and/or other materials provided with the distribution.
15ca5c5174SWarner Losh  * 3. Neither the name of the author nor the names of any co-contributors
160f7d6847SJulian Elischer  *    may be used to endorse or promote products derived from this software
170f7d6847SJulian Elischer  *    without specific prior written permission.
180f7d6847SJulian Elischer  *
190f7d6847SJulian Elischer  * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
200f7d6847SJulian Elischer  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
210f7d6847SJulian Elischer  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
220f7d6847SJulian Elischer  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
230f7d6847SJulian Elischer  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
240f7d6847SJulian Elischer  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
250f7d6847SJulian Elischer  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
260f7d6847SJulian Elischer  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
270f7d6847SJulian Elischer  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
280f7d6847SJulian Elischer  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
290f7d6847SJulian Elischer  * SUCH DAMAGE.
300f7d6847SJulian Elischer  */
310f7d6847SJulian Elischer #ifndef _PTHREAD_NP_H_
320f7d6847SJulian Elischer #define _PTHREAD_NP_H_
330f7d6847SJulian Elischer 
34c3f43618SDavid Xu #include <sys/param.h>
35c3f43618SDavid Xu #include <sys/cpuset.h>
36c3f43618SDavid Xu 
370f7d6847SJulian Elischer /*
38b847980fSJohn Birrell  * Non-POSIX type definitions:
39b847980fSJohn Birrell  */
40bb28f3c2SWarner Losh typedef void	(*pthread_switch_routine_t)(pthread_t, pthread_t);
41b847980fSJohn Birrell 
42b847980fSJohn Birrell /*
430f7d6847SJulian Elischer  * Non-POSIX thread function prototype definitions:
440f7d6847SJulian Elischer  */
450f7d6847SJulian Elischer __BEGIN_DECLS
46bb28f3c2SWarner Losh int pthread_attr_setcreatesuspend_np(pthread_attr_t *);
47f7ed1917SMax Khon int pthread_attr_get_np(pthread_t, pthread_attr_t *);
48c3f43618SDavid Xu int pthread_attr_getaffinity_np(const pthread_attr_t *, size_t, cpuset_t *);
49c3f43618SDavid Xu int pthread_attr_setaffinity_np(pthread_attr_t *, size_t, const cpuset_t *);
504627d47bSKonstantin Belousov void pthread_get_name_np(pthread_t, char *, size_t);
51c3f43618SDavid Xu int pthread_getaffinity_np(pthread_t, size_t, cpuset_t *);
52678b238cSJung-uk Kim int pthread_getthreadid_np(void);
5304249148SDaniel Eischen int pthread_main_np(void);
54bb28f3c2SWarner Losh int pthread_multi_np(void);
5504249148SDaniel Eischen int pthread_mutexattr_getkind_np(pthread_mutexattr_t);
5604249148SDaniel Eischen int pthread_mutexattr_setkind_np(pthread_mutexattr_t *, int);
57093fcf16SDavid Xu int pthread_mutex_getspinloops_np(pthread_mutex_t *mutex, int *count);
58093fcf16SDavid Xu int pthread_mutex_setspinloops_np(pthread_mutex_t *mutex, int count);
59093fcf16SDavid Xu int pthread_mutex_getyieldloops_np(pthread_mutex_t *mutex, int *count);
60093fcf16SDavid Xu int pthread_mutex_setyieldloops_np(pthread_mutex_t *mutex, int count);
611cbdac26SDag-Erling Smørgrav int pthread_mutex_isowned_np(pthread_mutex_t *mutex);
62d9cf2913SKonstantin Belousov void pthread_resume_all_np(void);
63d9cf2913SKonstantin Belousov int pthread_resume_np(pthread_t);
64*132fb3dcSKonstantin Belousov int pthread_peekjoin_np(pthread_t, void **);
65d9cf2913SKonstantin Belousov void pthread_set_name_np(pthread_t, const char *);
66c3f43618SDavid Xu int pthread_setaffinity_np(pthread_t, size_t, const cpuset_t *);
67bb28f3c2SWarner Losh int pthread_single_np(void);
68943dffc8SMax Khon void pthread_suspend_all_np(void);
69bb28f3c2SWarner Losh int pthread_suspend_np(pthread_t);
70bb28f3c2SWarner Losh int pthread_switch_add_np(pthread_switch_routine_t);
71bb28f3c2SWarner Losh int pthread_switch_delete_np(pthread_switch_routine_t);
72a48182f7SDavid Xu int pthread_timedjoin_np(pthread_t, void **, const struct timespec *);
730f7d6847SJulian Elischer __END_DECLS
740f7d6847SJulian Elischer 
750f7d6847SJulian Elischer #endif
76