Usage of Arduino_Threads
requires extension of ArduinoCore-mbed
(Danger of CPU hogging)
#44
Labels
type: imperfection
Perceived defect in any part of project
In order to avoid CPU hogging by the main thread (
loop()
of*.ino
file) it is necessary to addrtos::ThisThread::yield();
to ArduinoCore-mbed as shown below:for (;;) { loop(); if (arduino::serialEventRun) arduino::serialEventRun(); + rtos::ThisThread::yield(); }
For all
*.inot
defined threads this is automatically done by this code executed after calling the thread'sloop()
function.Since this is currently not the case
rtos::ThisThread::yield();
is currently called within the main thread of each example (i.e. here) and I think we should rather avoid exposing the raw mbed API to the wider public.Any side effects you can think of @facchinm?
CC @pnndra @giulcioffi @pennam @MaxPayne86
The text was updated successfully, but these errors were encountered: