1c0f25c26SImre Vadász /*
2c0f25c26SImre Vadász * Copyright (c) 2017 Imre Vadász <imre@vdsz.com>.
3c0f25c26SImre Vadász * All rights reserved.
4c0f25c26SImre Vadász *
5c0f25c26SImre Vadász * Redistribution and use in source and binary forms, with or without
6c0f25c26SImre Vadász * modification, are permitted provided that the following conditions
7c0f25c26SImre Vadász * are met:
8c0f25c26SImre Vadász * 1. Redistributions of source code must retain the above copyright
9c0f25c26SImre Vadász * notice, this list of conditions and the following disclaimer.
10c0f25c26SImre Vadász * 2. Redistributions in binary form must reproduce the above copyright
11c0f25c26SImre Vadász * notice, this list of conditions and the following disclaimer in the
12c0f25c26SImre Vadász * documentation and/or other materials provided with the distribution.
13c0f25c26SImre Vadász *
14c0f25c26SImre Vadász * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
15c0f25c26SImre Vadász * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16c0f25c26SImre Vadász * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17c0f25c26SImre Vadász * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18c0f25c26SImre Vadász * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19c0f25c26SImre Vadász * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20c0f25c26SImre Vadász * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21c0f25c26SImre Vadász * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22c0f25c26SImre Vadász * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23c0f25c26SImre Vadász * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24c0f25c26SImre Vadász * SUCH DAMAGE.
25c0f25c26SImre Vadász *
26c0f25c26SImre Vadász */
27c0f25c26SImre Vadász
28c0f25c26SImre Vadász #include "namespace.h"
29c0f25c26SImre Vadász #include <pthread.h>
30c0f25c26SImre Vadász #include <pthread_np.h>
31c0f25c26SImre Vadász #include "un-namespace.h"
32c0f25c26SImre Vadász
33c0f25c26SImre Vadász #include "thr_private.h"
34c0f25c26SImre Vadász
35c0f25c26SImre Vadász int
_pthread_getthreadid_np(void)36c0f25c26SImre Vadász _pthread_getthreadid_np(void)
37c0f25c26SImre Vadász {
38*940be950Szrj pthread_t curthread = tls_get_curthread();
39c0f25c26SImre Vadász return curthread->tid;
40c0f25c26SImre Vadász }
41c0f25c26SImre Vadász
42c0f25c26SImre Vadász __strong_reference(_pthread_getthreadid_np, pthread_getthreadid_np);
43