xref: /netbsd-src/tests/lib/libpthread/h_exit.c (revision ac555471cafe6fc06b9337a8708e2b398bf714c8)
1*ac555471Sjmmv /* $NetBSD: h_exit.c,v 1.1 2010/07/16 15:42:53 jmmv Exp $ */
2*ac555471Sjmmv 
3*ac555471Sjmmv /*
4*ac555471Sjmmv  * Copyright (c) 2008 The NetBSD Foundation, Inc.
5*ac555471Sjmmv  * All rights reserved.
6*ac555471Sjmmv  *
7*ac555471Sjmmv  * Redistribution and use in source and binary forms, with or without
8*ac555471Sjmmv  * modification, are permitted provided that the following conditions
9*ac555471Sjmmv  * are met:
10*ac555471Sjmmv  * 1. Redistributions of source code must retain the above copyright
11*ac555471Sjmmv  *    notice, this list of conditions and the following disclaimer.
12*ac555471Sjmmv  * 2. Redistributions in binary form must reproduce the above copyright
13*ac555471Sjmmv  *    notice, this list of conditions and the following disclaimer in the
14*ac555471Sjmmv  *    documentation and/or other materials provided with the distribution.
15*ac555471Sjmmv  *
16*ac555471Sjmmv  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17*ac555471Sjmmv  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18*ac555471Sjmmv  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19*ac555471Sjmmv  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20*ac555471Sjmmv  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21*ac555471Sjmmv  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22*ac555471Sjmmv  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23*ac555471Sjmmv  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24*ac555471Sjmmv  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25*ac555471Sjmmv  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26*ac555471Sjmmv  * POSSIBILITY OF SUCH DAMAGE.
27*ac555471Sjmmv  */
28*ac555471Sjmmv 
29*ac555471Sjmmv #include <sys/cdefs.h>
30*ac555471Sjmmv __COPYRIGHT("@(#) Copyright (c) 2008\
31*ac555471Sjmmv  The NetBSD Foundation, inc. All rights reserved.");
32*ac555471Sjmmv __RCSID("$NetBSD: h_exit.c,v 1.1 2010/07/16 15:42:53 jmmv Exp $");
33*ac555471Sjmmv 
34*ac555471Sjmmv #include <stdio.h>
35*ac555471Sjmmv #include <stdlib.h>
36*ac555471Sjmmv #include <pthread.h>
37*ac555471Sjmmv 
38*ac555471Sjmmv int
main(void)39*ac555471Sjmmv main(void)
40*ac555471Sjmmv {
41*ac555471Sjmmv 	printf("Test of pthread_exit() in main thread only.\n");
42*ac555471Sjmmv 
43*ac555471Sjmmv 	pthread_exit(NULL);
44*ac555471Sjmmv 
45*ac555471Sjmmv 	printf("You shouldn't see this.");
46*ac555471Sjmmv 	exit(1);
47*ac555471Sjmmv }
48