thr_main_np.c revision 75145
1264790Sbapt/*
2264790Sbapt * Copyright (c) 2001 Alfred Perlstein
3264790Sbapt * Author: Alfred Perlstein <alfred@FreeBSD.org>
4264790Sbapt * All rights reserved.
5264790Sbapt *
6264790Sbapt * Redistribution and use in source and binary forms, with or without
7264790Sbapt * modification, are permitted provided that the following conditions
8264790Sbapt * are met:
9264790Sbapt * 1. Redistributions of source code must retain the above copyright
10264790Sbapt *    notice, this list of conditions and the following disclaimer.
11264790Sbapt * 2. Redistributions in binary form must reproduce the above copyright
12264790Sbapt *    notice, this list of conditions and the following disclaimer in the
13264790Sbapt *    documentation and/or other materials provided with the distribution.
14264790Sbapt *
15264790Sbapt * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16264790Sbapt * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17264790Sbapt * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18264790Sbapt * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19264790Sbapt * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20264790Sbapt * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21264790Sbapt * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22264790Sbapt * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23264790Sbapt * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24264790Sbapt * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25264790Sbapt * SUCH DAMAGE.
26264790Sbapt *
27264790Sbapt *	$FreeBSD: head/lib/libkse/thread/thr_main_np.c 75145 2001-04-03 22:25:39Z iedowse $
28264790Sbapt */
29264790Sbapt
30264790Sbapt#include <pthread.h>
31264790Sbapt#include <pthread_np.h>
32264790Sbapt#include "pthread_private.h"
33264790Sbapt
34264790Sbapt/*
35264790Sbapt * Provide the equivelant to Solaris thr_main() function
36264790Sbapt */
37264790Sbapt#pragma weak    pthread_main_np=_pthread_main_np
38264790Sbaptint
39264790Sbapt_pthread_main_np()
40264790Sbapt{
41
42	if (!_thread_initial)
43		return (-1);
44	else
45		return (pthread_equal(pthread_self(), _thread_initial) ? 1 : 0);
46}
47