vTaskResume to a task waiting in ulTaskNotifyTake

I have a task waiting indefinitely for a task notification

ulTaskNotifyTake( pdTRUE, portMAX_DELAY );

when another task performs a vTaskResume() to the waiting task. Even though an infinite delay was specified the ulTaskNotifyTake returns when the vTaskResume is executed. This does not happen if instead using a semaphore because my understanding is that the resumed task is moved to the ready list but when it goes to run it the timeout is checked which hasn’t expired and goes back to waiting. But with the task notification it resumes even though the timeout hasn’t expired. The value returned by ulTaskNotifyTake is pdFALSE so I was able to wrap it with a loop

while(!ulTaskNotifyTake( pdTRUE, portMAX_DELAY )) ;

but I don’t need to do that for the semaphore and I expected the behavior to be similar to the semaphore. So is this the proper/expected behavior for task notifications or is this a bug?



Don’t have the code in front of me right now to check the details, but what you say makes sense as tasks using an infinite block time are, internally to the kernel, referenced from the same list as suspended tasks. Will need to look at the code to see how to prevent this.