summaryrefslogtreecommitdiff
path: root/components/libc/compilers/common
diff options
context:
space:
mode:
authorxiangxistu <[email protected]>2022-08-08 11:16:17 +0800
committerGitHub <[email protected]>2022-08-07 23:16:17 -0400
commite61d05ca1a9e6b8a83c928ab1f893246629bbd2f (patch)
tree969c06f626d801311ea827bdd0c0e0bea878e7ef /components/libc/compilers/common
parent79934777d04eddc54f6e608398091aaef6cc2aa4 (diff)
[fix] the risk for function exit() when open pthread support. (#6229)
* [fix] the risk for function exit() when open pthread support. * [update] modify annotation from "user data" to "pthread_data".
Diffstat (limited to 'components/libc/compilers/common')
-rw-r--r--components/libc/compilers/common/cstdlib.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/components/libc/compilers/common/cstdlib.c b/components/libc/compilers/common/cstdlib.c
index 9d1667b5d3..3ed5a228c8 100644
--- a/components/libc/compilers/common/cstdlib.c
+++ b/components/libc/compilers/common/cstdlib.c
@@ -21,8 +21,11 @@ void __rt_libc_exit(int status)
if (self != RT_NULL)
{
#ifdef RT_USING_PTHREADS
- extern void pthread_exit(void *value);
- pthread_exit((void *)status);
+ if(self->pthread_data != RT_NULL)
+ {
+ extern void pthread_exit(void *value);
+ pthread_exit((void *)status);
+ }
#else
LOG_E("thread:%s exit:%d!", self->name, status);
rt_thread_control(self, RT_THREAD_CTRL_CLOSE, RT_NULL);