|
|
@ -149,7 +149,17 @@ void taskShowInit (void) |
|
|
|
*/ |
|
|
|
LW_LIB_HOOK_STATIC void *taskWrapper (WIND_TCB *pTcb) |
|
|
|
{ |
|
|
|
vxRestart[pTcb->id] = LW_FALSE; |
|
|
|
int tid; |
|
|
|
|
|
|
|
if (pTcb) { |
|
|
|
tid = pTcb->id; |
|
|
|
|
|
|
|
} else { |
|
|
|
tid = HANDLE_TO_TID(API_ThreadIdSelf()); |
|
|
|
pTcb = &vxTcb[tid]; |
|
|
|
} |
|
|
|
|
|
|
|
vxRestart[tid] = LW_FALSE; |
|
|
|
|
|
|
|
if (pTcb->entry) { |
|
|
|
return ((void *)pTcb->entry(pTcb->arg[0], pTcb->arg[1], pTcb->arg[2], |
|
|
@ -187,6 +197,7 @@ STATUS taskInit (WIND_TCB *pTcb, char *name, int priority, |
|
|
|
_Vx_usr_arg_t arg9, _Vx_usr_arg_t arg10) |
|
|
|
{ |
|
|
|
LW_CLASS_THREADATTR attr = API_ThreadAttrGetDefault(); |
|
|
|
LW_HANDLE event; |
|
|
|
|
|
|
|
if (!pTcb || !name || !entryPt) { |
|
|
|
errno = EINVAL; |
|
|
@ -194,7 +205,7 @@ STATUS taskInit (WIND_TCB *pTcb, char *name, int priority, |
|
|
|
} |
|
|
|
|
|
|
|
attr.THREADATTR_pstkLowAddr = (PLW_STACK)pStackBase; |
|
|
|
attr.THREADATTR_pvArg = (PVOID)pTcb; |
|
|
|
attr.THREADATTR_pvArg = LW_NULL; |
|
|
|
attr.THREADATTR_stStackByteSize = (size_t)stackSize; |
|
|
|
attr.THREADATTR_ucPriority = (UINT8)priority; |
|
|
|
attr.THREADATTR_ulOption = LW_OPTION_THREAD_STK_CHK | LW_OPTION_THREAD_DETACHED; |
|
|
@ -211,10 +222,6 @@ STATUS taskInit (WIND_TCB *pTcb, char *name, int priority, |
|
|
|
pTcb->arg[8] = arg9; |
|
|
|
pTcb->arg[9] = arg10; |
|
|
|
|
|
|
|
if (pTcb->event) { |
|
|
|
API_EventSetDelete(&pTcb->event); |
|
|
|
} |
|
|
|
|
|
|
|
pTcb->event = API_EventSetCreate("vxWorks Event", 0ul, LW_OPTION_DEFAULT, LW_NULL); |
|
|
|
if (pTcb->event == LW_OBJECT_HANDLE_INVALID) { |
|
|
|
return (ERROR); |
|
|
@ -234,10 +241,15 @@ STATUS taskInit (WIND_TCB *pTcb, char *name, int priority, |
|
|
|
} |
|
|
|
|
|
|
|
VX_TCB_LOCK(); |
|
|
|
event = vxTcb[pTcb->id].event; |
|
|
|
vxTcb[pTcb->id] = *pTcb; |
|
|
|
lib_strlcpy(vxTcb[pTcb->id].name, name, VX_TASK_NAME_LENGTH + 1); |
|
|
|
VX_TCB_UNLOCK(); |
|
|
|
|
|
|
|
if (event) { |
|
|
|
API_EventSetDelete(&event); |
|
|
|
} |
|
|
|
|
|
|
|
return (OK); |
|
|
|
} |
|
|
|
|
|
|
|