mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +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:
parent
6f7eb2828a
commit
453eb2d064
@ -90,6 +90,9 @@ void preloop_update_frequency() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" bool can_yield() {
|
||||||
|
return cont_can_yield(g_pcont);
|
||||||
|
}
|
||||||
|
|
||||||
static inline void esp_yield_within_cont() __attribute__((always_inline));
|
static inline void esp_yield_within_cont() __attribute__((always_inline));
|
||||||
static void esp_yield_within_cont() {
|
static void esp_yield_within_cont() {
|
||||||
@ -98,7 +101,7 @@ static void esp_yield_within_cont() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void esp_yield() {
|
extern "C" void esp_yield() {
|
||||||
if (cont_can_yield(g_pcont)) {
|
if (can_yield()) {
|
||||||
esp_yield_within_cont();
|
esp_yield_within_cont();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -109,7 +112,7 @@ extern "C" void esp_schedule() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void __yield() {
|
extern "C" void __yield() {
|
||||||
if (cont_can_yield(g_pcont)) {
|
if (can_yield()) {
|
||||||
esp_schedule();
|
esp_schedule();
|
||||||
esp_yield_within_cont();
|
esp_yield_within_cont();
|
||||||
}
|
}
|
||||||
@ -121,7 +124,7 @@ extern "C" void __yield() {
|
|||||||
extern "C" void yield(void) __attribute__ ((weak, alias("__yield")));
|
extern "C" void yield(void) __attribute__ ((weak, alias("__yield")));
|
||||||
|
|
||||||
extern "C" void optimistic_yield(uint32_t interval_us) {
|
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)
|
(system_get_time() - s_micros_at_task_start) > interval_us)
|
||||||
{
|
{
|
||||||
yield();
|
yield();
|
||||||
|
@ -14,6 +14,7 @@ extern "C" {
|
|||||||
|
|
||||||
extern bool timeshift64_is_set;
|
extern bool timeshift64_is_set;
|
||||||
|
|
||||||
|
bool can_yield();
|
||||||
void esp_yield();
|
void esp_yield();
|
||||||
void esp_schedule();
|
void esp_schedule();
|
||||||
void tune_timeshift64 (uint64_t now_us);
|
void tune_timeshift64 (uint64_t now_us);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -37,6 +37,11 @@ extern "C" void yield()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" bool can_yield()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" void optimistic_yield (uint32_t interval_us)
|
extern "C" void optimistic_yield (uint32_t interval_us)
|
||||||
{
|
{
|
||||||
usleep(interval_us);
|
usleep(interval_us);
|
||||||
@ -69,3 +74,4 @@ cont_t* g_pcont = NULL;
|
|||||||
extern "C" void cont_yield(cont_t*)
|
extern "C" void cont_yield(cont_t*)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user