提交 478ad22b 编写于 作者: C caifuzhou

修改了接口名字

Signed-off-by: Ncaifuzhou <caifuzhou@huawei.com>
上级 7d383b13
......@@ -20,16 +20,16 @@ void* pthread_test(void* arg)
int main(int argc, char const *argv[])
{
pthread_mutex_init(&mutex, NULL);
TEST(gettid() == pthread_gettid(pthread_self()),"pthread_gettid() is failed\n");
TEST(gettid() == pthread_gettid_np(pthread_self()),"pthread_gettid_np() is failed\n");
pthread_mutex_lock(&mutex);
pid_t tid;
pthread_t t;
pthread_create(&t,NULL,pthread_test,&tid);
pid_t recv_result = pthread_gettid(t);
pid_t recv_result = pthread_gettid_np(t);
TEST(0 == pthread_join(t,NULL),"pthread_join is failed\n");
pthread_mutex_unlock(&mutex);
TEST(tid == recv_result,"the tid of pthread or tid of pthread_gettid is wrong\n");
TEST(tid == recv_result,"the tid of pthread or tid of pthread_gettid_np() is wrong\n");
return 0;
}
\ No newline at end of file
......@@ -23,7 +23,7 @@ functional_list = [
"pthread_cancel-points",
"pthread_cancel",
"pthread_cond",
"pthread_gettid",
"pthread_gettid_np",
"pthread_mutex",
"pthread_mutex_pi",
"pthread_robust",
......
......@@ -96,7 +96,7 @@ int pthread_create(pthread_t *__restrict, const pthread_attr_t *__restrict, void
int pthread_detach(pthread_t);
_Noreturn void pthread_exit(void *);
int pthread_join(pthread_t, void **);
pid_t pthread_gettid(pthread_t);
pid_t pthread_gettid_np(pthread_t);
#ifdef __GNUC__
__attribute__((const))
......
......@@ -407,15 +407,16 @@ struct pthread* __pthread_list_find(pthread_t thread_id, const char* info)
while (t != self) {
if (t == thread) return thread;
t = t->next ;
}
}
log_print("invalid pthread_t %p passed to %s\n", thread, info);
return NULL;
}
pid_t __pthread_gettid(pthread_t t)
pid_t __pthread_gettid_np(pthread_t t)
{
__tl_lock();
struct pthread* thread = __pthread_list_find(t, "pthread_gettid");
__tl_unlock();
return thread ? thread->tid : -1;
}
weak_alias(__pthread_gettid, pthread_gettid);
\ No newline at end of file
weak_alias(__pthread_gettid_np, pthread_gettid_np);
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册