xref: /freebsd/lib/libthr/thread/thr_single_np.c (revision f8bbbce458194ff4312c610d32a64ff4a3a71d45)
1*8a16b7a1SPedro F. Giffuni /*-
2*8a16b7a1SPedro F. Giffuni  * SPDX-License-Identifier: BSD-3-Clause
3*8a16b7a1SPedro F. Giffuni  *
4a091d823SDavid Xu  * Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
5a091d823SDavid Xu  * All rights reserved.
6a091d823SDavid Xu  *
7a091d823SDavid Xu  * Redistribution and use in source and binary forms, with or without
8a091d823SDavid Xu  * modification, are permitted provided that the following conditions
9a091d823SDavid Xu  * are met:
10a091d823SDavid Xu  * 1. Redistributions of source code must retain the above copyright
11a091d823SDavid Xu  *    notice, this list of conditions and the following disclaimer.
12a091d823SDavid Xu  * 2. Redistributions in binary form must reproduce the above copyright
13a091d823SDavid Xu  *    notice, this list of conditions and the following disclaimer in the
14a091d823SDavid Xu  *    documentation and/or other materials provided with the distribution.
15fed32d75SWarner Losh  * 3. Neither the name of the author nor the names of any co-contributors
16a091d823SDavid Xu  *    may be used to endorse or promote products derived from this software
17a091d823SDavid Xu  *    without specific prior written permission.
18a091d823SDavid Xu  *
19a091d823SDavid Xu  * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
20a091d823SDavid Xu  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21a091d823SDavid Xu  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22a091d823SDavid Xu  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23a091d823SDavid Xu  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24a091d823SDavid Xu  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25a091d823SDavid Xu  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26a091d823SDavid Xu  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27a091d823SDavid Xu  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28a091d823SDavid Xu  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29a091d823SDavid Xu  * SUCH DAMAGE.
30a091d823SDavid Xu  */
31a091d823SDavid Xu 
3237a6356bSDavid Xu #include "namespace.h"
33a091d823SDavid Xu #include <pthread.h>
34a091d823SDavid Xu #include <pthread_np.h>
3537a6356bSDavid Xu #include "un-namespace.h"
36a091d823SDavid Xu 
37a091d823SDavid Xu __weak_reference(_pthread_single_np, pthread_single_np);
38a091d823SDavid Xu 
395c43c9a1SKonstantin Belousov int
_pthread_single_np(void)405c43c9a1SKonstantin Belousov _pthread_single_np(void)
41a091d823SDavid Xu {
42a091d823SDavid Xu 
43a091d823SDavid Xu 	/* Enter single-threaded (non-POSIX) scheduling mode: */
4437a6356bSDavid Xu 	_pthread_suspend_all_np();
45a091d823SDavid Xu 	/*
46a091d823SDavid Xu 	 * XXX - Do we want to do this?
47a091d823SDavid Xu 	 * __is_threaded = 0;
48a091d823SDavid Xu 	 */
49a091d823SDavid Xu 	return (0);
50a091d823SDavid Xu }
51