Skip to content

Usage of Arduino_Threads requires extension of ArduinoCore-mbed (Danger of CPU hogging) #44

Closed
@aentinger

Description

@aentinger

In order to avoid CPU hogging by the main thread (loop() of *.ino file) it is necessary to add rtos::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's loop() 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions