| 84 | } |
| 85 | |
| 86 | void ConditionVariableESP32::notify_one() FL_NOEXCEPT { |
| 87 | if (mMutex == nullptr || mWaitQueue == nullptr) { |
| 88 | return; |
| 89 | } |
| 90 | |
| 91 | SemaphoreHandle_t mutex = static_cast<SemaphoreHandle_t>(mMutex); |
| 92 | QueueHandle_t queue = static_cast<QueueHandle_t>(mWaitQueue); |
| 93 | |
| 94 | // Lock internal mutex |
| 95 | xSemaphoreTake(mutex, portMAX_DELAY); |
| 96 | |
| 97 | // Try to dequeue one waiting task |
| 98 | WaitingTask waiter; |
| 99 | if (xQueueReceive(queue, &waiter, 0) == pdTRUE) { |
| 100 | // Mark as notified and wake the task |
| 101 | waiter.notified = true; |
| 102 | xTaskNotifyGive(waiter.task); |
| 103 | } |
| 104 | |
| 105 | // Unlock internal mutex |
| 106 | xSemaphoreGive(mutex); |
| 107 | } |
| 108 | |
| 109 | void ConditionVariableESP32::notify_all() FL_NOEXCEPT { |
| 110 | if (mMutex == nullptr || mWaitQueue == nullptr) { |
no outgoing calls
no test coverage detected