!55 【轻量级 PR】:fix pthread_create timing bug
Merge pull request !55 from Caoruihong/N/A
This commit is contained in:
commit
4fc4b8c9c1
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue