Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Musl
提交
00b2c5ee
T
Third Party Musl
项目概览
OpenHarmony
/
Third Party Musl
接近 2 年 前同步成功
通知
37
Star
125
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Musl
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
00b2c5ee
编写于
1月 13, 2022
作者:
O
openharmony_ci
提交者:
Gitee
1月 13, 2022
浏览文件
操作
浏览文件
下载
差异文件
!206 修改接口名为pthread_gettid_np
Merge pull request !206 from caifuzhou/addAPI
上级
ce1ec633
9efa23d4
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
10 addition
and
9 deletion
+10
-9
libc-test/src/functional/pthread_gettid_np.c
libc-test/src/functional/pthread_gettid_np.c
+3
-3
libc-test/src/functional/test_src_functional.gni
libc-test/src/functional/test_src_functional.gni
+1
-1
porting/linux/user/include/pthread.h
porting/linux/user/include/pthread.h
+1
-1
src/thread/pthread_create.c
src/thread/pthread_create.c
+5
-4
未找到文件。
libc-test/src/functional/pthread_gettid.c
→
libc-test/src/functional/pthread_gettid
_np
.c
浏览文件 @
00b2c5ee
...
@@ -20,16 +20,16 @@ void* pthread_test(void* arg)
...
@@ -20,16 +20,16 @@ void* pthread_test(void* arg)
int
main
(
int
argc
,
char
const
*
argv
[])
int
main
(
int
argc
,
char
const
*
argv
[])
{
{
pthread_mutex_init
(
&
mutex
,
NULL
);
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
);
pthread_mutex_lock
(
&
mutex
);
pid_t
tid
;
pid_t
tid
;
pthread_t
t
;
pthread_t
t
;
pthread_create
(
&
t
,
NULL
,
pthread_test
,
&
tid
);
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
"
);
TEST
(
0
==
pthread_join
(
t
,
NULL
),
"pthread_join is failed
\n
"
);
pthread_mutex_unlock
(
&
mutex
);
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
;
return
0
;
}
}
\ No newline at end of file
libc-test/src/functional/test_src_functional.gni
浏览文件 @
00b2c5ee
...
@@ -23,7 +23,7 @@ functional_list = [
...
@@ -23,7 +23,7 @@ functional_list = [
"pthread_cancel-points",
"pthread_cancel-points",
"pthread_cancel",
"pthread_cancel",
"pthread_cond",
"pthread_cond",
"pthread_gettid",
"pthread_gettid
_np
",
"pthread_mutex",
"pthread_mutex",
"pthread_mutex_pi",
"pthread_mutex_pi",
"pthread_robust",
"pthread_robust",
...
...
porting/linux/user/include/pthread.h
浏览文件 @
00b2c5ee
...
@@ -89,7 +89,7 @@ int pthread_create(pthread_t *__restrict, const pthread_attr_t *__restrict, void
...
@@ -89,7 +89,7 @@ int pthread_create(pthread_t *__restrict, const pthread_attr_t *__restrict, void
int
pthread_detach
(
pthread_t
);
int
pthread_detach
(
pthread_t
);
_Noreturn
void
pthread_exit
(
void
*
);
_Noreturn
void
pthread_exit
(
void
*
);
int
pthread_join
(
pthread_t
,
void
**
);
int
pthread_join
(
pthread_t
,
void
**
);
pid_t
pthread_gettid
(
pthread_t
);
pid_t
pthread_gettid
_np
(
pthread_t
);
#ifdef __GNUC__
#ifdef __GNUC__
__attribute__
((
const
))
__attribute__
((
const
))
...
...
src/thread/pthread_create.c
浏览文件 @
00b2c5ee
...
@@ -407,15 +407,16 @@ struct pthread* __pthread_list_find(pthread_t thread_id, const char* info)
...
@@ -407,15 +407,16 @@ struct pthread* __pthread_list_find(pthread_t thread_id, const char* info)
while
(
t
!=
self
)
{
while
(
t
!=
self
)
{
if
(
t
==
thread
)
return
thread
;
if
(
t
==
thread
)
return
thread
;
t
=
t
->
next
;
t
=
t
->
next
;
}
}
log_print
(
"invalid pthread_t %p passed to %s
\n
"
,
thread
,
info
);
return
NULL
;
return
NULL
;
}
}
pid_t
__pthread_gettid
(
pthread_t
t
)
pid_t
__pthread_gettid
_np
(
pthread_t
t
)
{
{
__tl_lock
();
__tl_lock
();
struct
pthread
*
thread
=
__pthread_list_find
(
t
,
"pthread_gettid"
);
struct
pthread
*
thread
=
__pthread_list_find
(
t
,
"pthread_gettid
_np
"
);
__tl_unlock
();
__tl_unlock
();
return
thread
?
thread
->
tid
:
-
1
;
return
thread
?
thread
->
tid
:
-
1
;
}
}
weak_alias
(
__pthread_gettid
,
pthread_gettid
);
weak_alias
(
__pthread_gettid_np
,
pthread_gettid_np
);
\ No newline at end of file
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录