Skip to content

Commit

Permalink
Fix #424, Add looping wait for self exiting task
Browse files Browse the repository at this point in the history
  • Loading branch information
skliper committed Apr 20, 2020
1 parent 7d9c4c8 commit 5a09605
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/tests/osal-core-test/osal-core-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ void TestTasks(void)
int tasknum;
uint32 saved_task0_id;
static TestTaskData TaskData[OS_MAX_TASKS + 1];
OS_task_prop_t taskprop;
int loopcnt;

/* OS_TaskRegister(); */

Expand Down Expand Up @@ -118,16 +120,19 @@ void TestTasks(void)
status = OS_TaskCreate( &TaskData[tasknum].task_id, taskname, task_generic_with_exit, TaskData[tasknum].task_stack,
TASK_0_STACK_SIZE, (250 - OS_MAX_TASKS) + tasknum, 0);

/*
* A small delay in this parent task to allow the child task to run.
* It should exit immediately....
*/
OS_TaskDelay(10);

UtDebug("Create %s Status = %d, Id = %d\n",taskname,(int)status,(int)TaskData[tasknum].task_id);

UtAssert_True(status == OS_SUCCESS, "OS_TaskCreate, self exiting task");

/* Looping delay in parent task to wait for child task to exit */
loopcnt = 0;
while (OS_TaskGetInfo(TaskData[tasknum].task_id, &taskprop) == OS_SUCCESS)
{
OS_TaskDelay(10);
loopcnt++;
}
UtDebug("Looped %d times waiting for child task Id %d to exit\n", loopcnt, (int)TaskData[tasknum].task_id);

/*
* Attempting to delete the task that exited itself should always fail
*/
Expand Down

0 comments on commit 5a09605

Please sign in to comment.