8000 Pluggable Scheduler: Make entry points into sequential cont/user scheduler weak functions by dok-net · Pull Request #6182 · esp8266/Arduino · GitHub
[go: up one dir, main page]

Skip to content

Pluggable Scheduler: Make entry points into sequential cont/user scheduler weak functions #6182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Two-level hook system for esp_yield to accommodate host test environment
  • Loading branch information
dok-net committed Sep 18, 2019
commit cb44d521b6b550ba5c423df11b40b2e61a8fcfeb
6 changes: 4 additions & 2 deletions cores/esp8266/core_esp8266_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,15 @@ void preloop_update_frequency() {
#endif
}

extern "C" void esp_yield() __attribute__((weak));
extern "C" void esp_yield() {
extern "C" void __esp_yield() __attribute__((weak));
extern "C" void __esp_yield() {
if (cont_can_yield(g_pcont)) {
cont_yield(g_pcont);
}
}

extern "C" void esp_yield(void) __attribute__ ((weak, alias("__esp_yield")));

extern "C" void esp_schedule() {
// always on CONT stack here
ets_post(LOOP_TASK_PRIORITY, 0, 0);
Expand Down
22 changes: 13 additions & 9 deletions libraries/Schedule/src/Schedule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,22 @@
#include <interrupts.h>
#include <coredecls.h>

extern "C" void esp_loop()
extern "C"
{
loop();
run_scheduled_functions();
run_scheduled_recurrent_functions();}
void esp_loop()
{
loop();
run_scheduled_functions();
run_scheduled_recurrent_functions();
}

extern "C" void esp_yield()
{
if (cont_can_yield(g_pcont)) {
cont_yield(g_pcont);
void __esp_yield();

extern "C" void esp_yield()
{
__esp_yield();
run_scheduled_recurrent_functions();
}
run_scheduled_recurrent_functions();
}

typedef std::function<void(void)> mSchedFuncT;
Expand Down
2 changes: 1 addition & 1 deletion tests/host/common/Arduino.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ extern "C" void optimistic_yield (uint32_t interval_us)
usleep(interval_us);
}

extern "C" void esp_yield()
extern "C" void __esp_yield()
{
}

Expand Down
0