am 27efc488: Add pthread_gettid_np and re-expose __get_thread for LP32.
* commit '27efc48814b8153c55cbcd0af5d9add824816e69': Add pthread_gettid_np and re-expose __get_thread for LP32.
This commit is contained in:
commit
66265e80a1
@ -157,6 +157,7 @@ libc_bionic_src_files := \
|
||||
bionic/pthread_exit.cpp \
|
||||
bionic/pthread_getcpuclockid.cpp \
|
||||
bionic/pthread_getschedparam.cpp \
|
||||
bionic/pthread_gettid_np.cpp \
|
||||
bionic/pthread_internals.cpp \
|
||||
bionic/pthread_join.cpp \
|
||||
bionic/pthread_key.cpp \
|
||||
|
@ -28,7 +28,6 @@
|
||||
|
||||
#include "pthread_internal.h"
|
||||
#include "private/bionic_futex.h"
|
||||
#include "private/bionic_pthread.h"
|
||||
#include "private/kernel_sigset_t.h"
|
||||
|
||||
#include <errno.h>
|
||||
@ -159,7 +158,7 @@ int timer_create(clockid_t clock_id, sigevent* evp, timer_t* timer_id) {
|
||||
sigevent se = *evp;
|
||||
se.sigev_signo = TIMER_SIGNAL;
|
||||
se.sigev_notify = SIGEV_THREAD_ID;
|
||||
se.sigev_notify_thread_id = __pthread_gettid(timer->callback_thread);
|
||||
se.sigev_notify_thread_id = pthread_gettid_np(timer->callback_thread);
|
||||
if (__timer_create(clock_id, &se, &timer->kernel_timer_id) == -1) {
|
||||
__timer_thread_stop(timer);
|
||||
return -1;
|
||||
|
39
libc/bionic/pthread_gettid_np.cpp
Normal file
39
libc/bionic/pthread_gettid_np.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "pthread_internal.h"
|
||||
#include "private/bionic_pthread.h"
|
||||
|
||||
pid_t pthread_gettid_np(pthread_t t) {
|
||||
return reinterpret_cast<pthread_internal_t*>(t)->tid;
|
||||
}
|
||||
|
||||
// TODO: move callers over to pthread_gettid_np and remove this.
|
||||
pid_t __pthread_gettid(pthread_t t) {
|
||||
return pthread_gettid_np(t);
|
||||
}
|
@ -98,7 +98,9 @@ __LIBC_HIDDEN__ int __init_thread(pthread_internal_t* thread, bool add_to_thread
|
||||
__LIBC_HIDDEN__ void __init_tls(pthread_internal_t* thread);
|
||||
__LIBC_HIDDEN__ void __init_alternate_signal_stack(pthread_internal_t*);
|
||||
__LIBC_HIDDEN__ void _pthread_internal_add(pthread_internal_t* thread);
|
||||
__LIBC_HIDDEN__ pthread_internal_t* __get_thread(void);
|
||||
|
||||
/* Various third-party apps contain a backport of our pthread_rwlock implementation that uses this. */
|
||||
extern "C" __LIBC64_HIDDEN__ pthread_internal_t* __get_thread(void);
|
||||
|
||||
__LIBC_HIDDEN__ void pthread_key_clean_all(void);
|
||||
__LIBC_HIDDEN__ void _pthread_internal_remove_locked(pthread_internal_t* thread);
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include "pthread_internal.h"
|
||||
|
||||
#include "private/bionic_futex.h"
|
||||
#include "private/bionic_pthread.h"
|
||||
#include "private/bionic_tls.h"
|
||||
#include "private/ScopedPthreadMutexLocker.h"
|
||||
|
||||
@ -69,10 +68,6 @@ pthread_internal_t* __get_thread(void) {
|
||||
return reinterpret_cast<pthread_internal_t*>(__get_tls()[TLS_SLOT_THREAD_ID]);
|
||||
}
|
||||
|
||||
pid_t __pthread_gettid(pthread_t t) {
|
||||
return reinterpret_cast<pthread_internal_t*>(t)->tid;
|
||||
}
|
||||
|
||||
// Initialize 'ts' with the difference between 'abstime' and the current time
|
||||
// according to 'clock'. Returns -1 if abstime already expired, or 0 otherwise.
|
||||
int __timespec_from_absolute(timespec* ts, const timespec* abstime, clockid_t clock) {
|
||||
|
@ -188,6 +188,8 @@ int pthread_getschedparam(pthread_t, int*, struct sched_param*) __nonnull((2, 3)
|
||||
|
||||
void* pthread_getspecific(pthread_key_t);
|
||||
|
||||
pid_t pthread_gettid_np(pthread_t);
|
||||
|
||||
int pthread_join(pthread_t, void**);
|
||||
|
||||
int pthread_key_create(pthread_key_t*, void (*)(void*)) __nonnull((1));
|
||||
|
Loading…
x
Reference in New Issue
Block a user