mirror of
https://github.com/esphome/esphome.git
synced 2025-01-31 02:00:55 +00:00
[esp32_ble] do not skip events if queue is blocked (#7960)
This commit is contained in:
parent
85d863601b
commit
f33b4a714e
@ -26,10 +26,10 @@ template<class T> class Queue {
|
|||||||
void push(T *element) {
|
void push(T *element) {
|
||||||
if (element == nullptr)
|
if (element == nullptr)
|
||||||
return;
|
return;
|
||||||
if (xSemaphoreTake(m_, 5L / portTICK_PERIOD_MS)) {
|
// It is not called from main loop. Thus it won't block main thread.
|
||||||
q_.push(element);
|
xSemaphoreTake(m_, portMAX_DELAY);
|
||||||
xSemaphoreGive(m_);
|
q_.push(element);
|
||||||
}
|
xSemaphoreGive(m_);
|
||||||
}
|
}
|
||||||
|
|
||||||
T *pop() {
|
T *pop() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user