fix deadlock between xEventGroupWaitBits and API lock semaphore

Merges https://github.com/espressif/esp-mqtt/pull/124
Closes https://github.com/espressif/esp-mqtt/issues/122
This commit is contained in:
Thomas Bernard
2019-08-01 19:01:54 -04:00
committed by David Cermak
parent 2fef1a07c5
commit cbae6343e9

View File

@ -1168,9 +1168,9 @@ esp_err_t esp_mqtt_client_stop(esp_mqtt_client_handle_t client)
}
client->run = false;
xEventGroupWaitBits(client->status_bits, STOPPED_BIT, false, true, portMAX_DELAY);
client->state = MQTT_STATE_UNKNOWN;
MQTT_API_UNLOCK_FROM_OTHER_TASK(client);
xEventGroupWaitBits(client->status_bits, STOPPED_BIT, false, true, portMAX_DELAY);
return ESP_OK;
} else {
ESP_LOGW(TAG, "Client asked to stop, but was not started");