1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-05 12:42:22 +03:00

Add wait loop at the end of mode, refactor can_yield (#6721)

* Add wait loop at the end of mode, refactor can_yield

* fix mock build
This commit is contained in:
Develo
2019-11-07 18:25:20 -03:00
committed by GitHub
parent 6f7eb2828a
commit 453eb2d064
4 changed files with 829 additions and 799 deletions

View File

@ -90,6 +90,9 @@ void preloop_update_frequency() {
#endif
}
extern "C" bool can_yield() {
return cont_can_yield(g_pcont);
}
static inline void esp_yield_within_cont() __attribute__((always_inline));
static void esp_yield_within_cont() {
@ -98,7 +101,7 @@ static void esp_yield_within_cont() {
}
extern "C" void esp_yield() {
if (cont_can_yield(g_pcont)) {
if (can_yield()) {
esp_yield_within_cont();
}
}
@ -109,7 +112,7 @@ extern "C" void esp_schedule() {
}
extern "C" void __yield() {
if (cont_can_yield(g_pcont)) {
if (can_yield()) {
esp_schedule();
esp_yield_within_cont();
}
@ -121,7 +124,7 @@ extern "C" void __yield() {
extern "C" void yield(void) __attribute__ ((weak, alias("__yield")));
extern "C" void optimistic_yield(uint32_t interval_us) {
if (cont_can_yield(g_pcont) &&
if (can_yield() &&
(system_get_time() - s_micros_at_task_start) > interval_us)
{
yield();