thr_self.c revision 157457
150397Sobrien/* 250397Sobrien * Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>. 318334Speter * All rights reserved. 418334Speter * 518334Speter * Redistribution and use in source and binary forms, with or without 618334Speter * modification, are permitted provided that the following conditions 718334Speter * are met: 818334Speter * 1. Redistributions of source code must retain the above copyright 918334Speter * notice, this list of conditions and the following disclaimer. 1018334Speter * 2. Redistributions in binary form must reproduce the above copyright 1118334Speter * notice, this list of conditions and the following disclaimer in the 1218334Speter * documentation and/or other materials provided with the distribution. 1318334Speter * 3. All advertising materials mentioning features or use of this software 1418334Speter * must display the following acknowledgement: 1518334Speter * This product includes software developed by John Birrell. 1618334Speter * 4. Neither the name of the author nor the names of any co-contributors 1718334Speter * may be used to endorse or promote products derived from this software 1818334Speter * without specific prior written permission. 1918334Speter * 2018334Speter * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND 2118334Speter * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2290075Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2318334Speter * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 2418334Speter * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2518334Speter * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2618334Speter * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2718334Speter * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2818334Speter * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2918334Speter * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3018334Speter * SUCH DAMAGE. 3118334Speter * 3218334Speter * $FreeBSD: head/lib/libthr/thread/thr_self.c 157457 2006-04-04 02:57:49Z davidxu $ 3318334Speter */ 3418334Speter 3518334Speter#include "namespace.h" 3618334Speter#include <pthread.h> 3718334Speter#include "un-namespace.h" 3818334Speter 3918334Speter#include "thr_private.h" 4018334Speter 4118334Speter__weak_reference(_pthread_self, pthread_self); 4218334Speter 4318334Speterpthread_t 4418334Speter_pthread_self(void) 4518334Speter{ 4618334Speter _thr_check_init(); 4718334Speter 4818334Speter /* Return the running thread pointer: */ 4918334Speter return (_get_curthread()); 5018334Speter} 5118334Speter