However, I can call yield () on my Nano or ESP8266 without enabling the lib scheduler
The yield() function is also implemented inside the ESP8266 libraries:
Yielding
This is one of the most important differences between the ESP8266 and the more classic Arduino microcontroller. The ESP8266 launches many utility functions in the background - maintaining WiFi, managing the TCP / IP stack, and other responsibilities. Blocking these functions from starting can cause the ESP8266 to crash and reset itself. To avoid these mysterious discharges, avoid the long, blocking loops in your sketch.
The amazing creators of the Arduino ESP8266 libraries also have a yield () function that requires background functions to let them do their thing.
This is why you can call yield() from your main program, which includes the ESP8266 header.
See ESP8266 Things Setup Guide .
Update
yield() is defined in Arduino.h as:
void yield(void);
yield() also declared in hooks.h as follows:
/** * Empty yield() hook. * * This function is intended to be used by library writers to build * libraries or sketches that supports cooperative threads. * * Its defined as a weak symbol and it can be redefined to implement a * real cooperative scheduler. */ static void __empty() { // Empty } void yield(void) __attribute__ ((weak, alias("__empty")));
So on Nano it probably does nothing (unless you have other #included libraries).
source share