FreeRTOS vTaskDelete() calls causes an Hang.

Hi All, I am spawning a thread using below function in FreeRTOS v9.0.0
    result = xTaskCreate( (TaskFunction_t)entry_function, name, (unsigned short)(stack_size / sizeof( portSTACK_TYPE )), (void*)arg, (unsigned portBASE_TYPE) priority, thread );

    return ( result == (signed portBASE_TYPE) pdPASS ) ? WWD_SUCCESS : WWD_THREAD_CREATE_FAILED;

    This Task is created. In this task I run an Iperf Server thread which receive packets from a remote endpoint with data rate of 60Mbps. After about 400 seconds, the Iperf Thread quits and in the calling thread

   vTaskDelete(NULL); 

   is called before exiting the function. this functions calls to remove the pxTCB from the list and here it hangs..
   (UBaseType_t uxListRemove( ListItem_t * const pxItemToRemove )
{ /* The list item knows which list it is in. Obtain the list from the list item. */ List_t * const pxList = ( List_t * ) pxItemToRemove->pvContainer;
pxItemToRemove->pxNext->pxPrevious = pxItemToRemove->pxPrevious;
pxItemToRemove->pxPrevious->pxNext = pxItemToRemove->pxNext;
)
Is this know problem with FreeRTOS the vTaskDelete(NULL) to remove resources fo r current thread causes an system hang.. Thanks Balaji.

FreeRTOS vTaskDelete() calls causes an Hang.

I’m not sure I full understand the scenario. When the Iperf server quits does the task that was running call vTaskDelete( NULL ), or does another task call that? A task cannot exit just by returning from its implementing function, if that is what the iPerf task is doing, and a task can only delete itself if it uses NULL as the parameter to vTaskDelete() (it must use a valid handle to delete a different task). Also deleting a task does not automatically delete the resources created by that task, if that is part of your question, it only deletes the task control block and stack that were created by the FreeRTOS itself. A couple of other points not related to your question: 1 – stack sizes are specified in words, not bytes, so deleting by sizeof( portSTACK_TYPE) might be creating a stack that is one quarter the size you think it is. 2 – the portBASETYPE, etc. types were deprecated long long before FreeRTOS V9.0.0. The equivalent now is BaseTypet. portBASETYPE will only be recongised if you have configENABLEBACKWARD_COMPATIBILITY set to 1 (or undefined, in which case it defaults to 1).

FreeRTOS vTaskDelete() calls causes an Hang.

Hi Richard, When the Iperf server quits does the task that was running call vTaskDelete( NULL ), or does another task call that?
Here the running task (Iperf server thread spawned) wants to exit and calls vTaskDelete(NULL) , it is the same task which is deleting itself.
Yes I understand the resources are not deleted, But I want the task to exit and another lower priority task to run, Here the Iperf Server task was running at Priority 7 and another console thread task runs at priority 4 which is lower. But the lower priority thread (console) 4 never runs because of this hang. ( for example: the console thread has to input the serial characters which it does not because of the hang.) Regarding point 1. that portStack_TYPE is inside the Free RTOS kernel I donot modify that code. I will check back on the portBASE_TYPE, again I am not modifying the FreeRTOS code here, not sure about this I will check. Thanks Balaji.