Skip to content

Commit 44714a9

Browse files
committed
yield() plugin code more straightforward, same efficiency
1 parent 4d8df2d commit 44714a9

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

cores/esp8266/core_esp8266_main.cpp

+3-8
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,10 @@ void preloop_update_frequency() {
8888
#endif
8989
}
9090

91-
extern "C" void __esp_yield_within_cont() {
92-
cont_yield(g_pcont);
93-
}
94-
95-
extern "C" void esp_yield_within_cont() __attribute__ ((weak, alias("__esp_yield_within_cont")));
96-
91+
extern "C" void esp_yield() __attribute__((weak));
9792
extern "C" void esp_yield() {
9893
if (cont_can_yield(g_pcont)) {
99-
esp_yield_within_cont();
94+
cont_yield(g_pcont);
10095
}
10196
}
10297

@@ -108,7 +103,7 @@ extern "C" void esp_schedule() {
108103
extern "C" void __yield() {
109104
if (cont_can_yield(g_pcont)) {
110105
esp_schedule();
111-
esp_yield_within_cont();
106+
esp_yield();
112107
}
113108
else {
114109
panic();

libraries/Schedule/src/Schedule.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ extern "C" void esp_loop()
1212
run_scheduled_functions();
1313
run_scheduled_recurrent_functions();}
1414

15-
extern "C" void esp_yield_within_cont()
15+
extern "C" void esp_yield()
1616
{
17-
cont_yield(g_pcont);
17+
if (cont_can_yield(g_pcont)) {
18+
cont_yield(g_pcont);
19+
}
1820
run_scheduled_recurrent_functions();
1921
}
2022

0 commit comments

Comments
 (0)