FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [April 2008 Threads] using a thread's own task handlePosted by Glen B. on April 29, 2008 Richard Barry et al
In a previous release, the following code was placed in VTaskDelete() ___/* Ensure a yield is performed if the current task is being ___deleted. */ ___if( pxTaskToDelete == pxCurrentTCB ) ___{ ___pxTaskToDelete = NULL; ___}
This ensures that a task can properly delete itself using its own task handle rather than NULL.
I thought similar code was also added to vTaskPrioritySet() although so far I have been unable to pin this down. Maybe I had added that myself. But the bottom line is that such code is needed. In the current version, if a task drops its own priority (using its task handle rather than NULL) below another ready task, the other ready task will not be properly scheduled to run (until the next re-scheduling for some other reason).
Glen
RE: using a thread's own task handlePosted by Richard on May 1, 2008 Looking at the history, it was also put into vTaskSuspend(), but not vTaskPrioritySet(). I have just added it in and will check in the changes very shortly.
Can you see anywhere else it should be added before I check it in? I think that's it.
Regards.
RE: using a thread's own task handlePosted by Glen B. on May 1, 2008 I think maybe the following in vTaskResume() needs should exclude the current task handle as well as NULL.
if( pxTCB != NULL ) {
RE: using a thread's own task handlePosted by Richard on May 1, 2008 >if( pxTCB != NULL ) >{
I have added the second check here:
if( ( pxTCB != NULL ) && ( pxTCB != pxCurrentTCB ) ) {
but arguably both could be removed as attempting to resume yourself (using either parameter) would be very odd.
Changes now checked in.
Regards.
RE: using a thread's own task handlePosted by Glen B. on May 1, 2008 Yes, that's why I was somewhat uncertain about the change to the resume function - however, SafeRTOS needs it, I presume.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|