Can lower priority task wake up a higher priority task?

Hello all! There are two tasks in my application: – Task1 is running on low priority; – Task2 is running on higher priority than Task1; Task2 usually spends most of its time in sleep (xSemaphoreTake(wakeup, …)). If Task1 detects an external event it needs to inform Task2 about it as soon as possible. So it obviously calls xSemaphoreGive(wakeup). (wakeup is a binary semaphore created by Task2) The symptom is that Task2 doesn’t wake up till the timeout in xSemaphoreTake expires. If Task1 and Task2 are on the same priority, this wakeup mechanism works like a charm. The conclusion is that a lower priority task can’t wake up (at least with xSemaphoreGive) a higher priority task. What am I doing wrong? Is it somehow possible to let a lower priority task wake up a higher priority one? Shall I use anything other than binary semaphores? Is my design wrong? Thanks, regards,

Can lower priority task wake up a higher priority task?

That operation works fine for me. Make sure that Task1 is seeing the same handle that Task2 created and not some other value due to two local variables with the same name.

Can lower priority task wake up a higher priority task?

Task1 and Task2 should see the same handle, since if I modify their priority to be the same, it begins working as expected. There may be some other problem in my program… There’s also a Task3 having the highest priority of all tasks, and Task1 can wake it up without any problem.

Can lower priority task wake up a higher priority task?

It was my mistake. A variable (independent of the semaphore) had to be given a new value just before xSemaphoreGive(…). Apparently, a lower priority task can wake up a higher priority one. Frankly, I would have been very disappointed if it hadn’t worked like this.