diff --git a/kal/posix/src/pthread.c b/kal/posix/src/pthread.c index a7e8893e6713cf00e35ebab5bf476adca39f6122..cd5d870283e617690c6823c20c54057f478cb743 100644 --- a/kal/posix/src/pthread.c +++ b/kal/posix/src/pthread.c @@ -97,7 +97,7 @@ int pthread_create(pthread_t *thread, const pthread_attr_t *attr, taskInitParam.pfnTaskEntry = PthreadEntry; taskInitParam.uwArg = (UINT32)(UINTPTR)pthreadData; - if (LOS_TaskCreate(&taskID, &taskInitParam) != LOS_OK) { + if (LOS_TaskCreateOnly(&taskID, &taskInitParam) != LOS_OK) { free(pthreadData); return EINVAL; } @@ -105,6 +105,8 @@ int pthread_create(pthread_t *thread, const pthread_attr_t *attr, /* set pthread default name */ (void)sprintf_s(taskInitParam.pcName, PTHREAD_NAMELEN, "pthread%u", taskID); + (void)LOS_TaskResume(taskID); + *thread = (pthread_t)taskID; return 0; }