Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By Geoffrey
#44975 Hello~

Could anyone advise if ESP8266-12F or ESP8266 supports multi-threading / scheduler, with Arduino IDE, to run multiple tasks simultaneously

Any working example code to demonstrate how to use the library and APIs would be highly appreciated

Best Regards,
User avatar
By mrburnette
with Arduino IDE, to run multiple tasks simultaneously - See more at: viewtopic.php?f=32&t=9386#sthash.TiMhzzQh.dpuf

Unlike PC/server products as Jave applications, the ArduinoIDE and libraries are not written to support multitasking. The best we can pull-off is FreeRTOS which allows the illusion of multitasking, but is really just a task scheduler... there is only 1 computing core in the uC, so concepts applied in the enterprise environment are not map-able into the uC world at this level of device. There is already a scheduler in the Arduino implementation that splits the time between the Arduino C++ code and the ESP8266 RF functions.

User avatar
By malachi
#47270 Actually, it is very possible - in theory. Any CPU with some stack space to spare can engage in "cooperative multitasking". It's a big topic, but long story short you as the programmer have to do a bit of extra work (not much) to notify the CPU when it's OK to multitask. Here's a place to start:

Arduino (AVR, SAM) has a nice library to do just this: Unfortunately, due to the lack of setjmp/longjmp implementation in ESP8266, libs such as this are not compatible. setjmp/longjmp can work on an ESP8266 - just nobody's implemented it yet. See: