From e61d05ca1a9e6b8a83c928ab1f893246629bbd2f Mon Sep 17 00:00:00 2001 From: xiangxistu <52819708+xiangxistu@users.noreply.github.com> Date: Mon, 8 Aug 2022 11:16:17 +0800 Subject: [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". --- components/libc/compilers/common/cstdlib.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'components/libc/compilers') 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); -- cgit v1.3.1