Semaphore pending ?

Dear All, I have a task1 like this :
for (;;) {
     xSemaphoreTake(XSemSend, portMAX_DELAY);
   // doing some consuming process
   }
in few other tasks during the consuming process of task1 I can have xSemaphoreGive (XsemSend); let’s say 6 times. I discovered that when the consuming process is done and it goes to SemaphoreTake waiting it immediately going again to consuming process, but only no more than 3 times, is this normal or not?
   Thanks and Rgds
   David

Semaphore pending ?

Sorry – I don’t understand your question. Are you saying that if you give a semaphore 6 times you would expect to be able to take it 6 times too? That would only be the case if the semaphore was created as a counting semaphore with the max count parameter set to 6 or greater. https://www.freertos.org/CreateCounting.html

Semaphore pending ?

Dear Richard, The Semaphore was created with xSemaphoreCreateBinary() so maxcount is 1 I believe, so if I have : task1 for (;;) { xSemaphoreTake(XSemSend, portMAX_DELAY); // doing some consuming process consuming 1 sec } task2
for (;;) { xSemaphoregive((XSemSend); vTaskDelay(100); count++; if( count == 10) vTaskDelete(NULL); } task1 should wakeup only one time ?

Semaphore pending ?

Task 2 is giving the semaphore back after 100ms which means Task1 can take it again.

Semaphore pending ?

yes of course but task 1 is busy during 1 sec so IMO it should not take again

Semaphore pending ?

You have a logic (pattern) problem. This will execute at least twice according to what you’ve posted, possibly more times depending on how quickly task 1 processes its data.