TcMenu / TaskManagerIO

A task, event, scheduling, and interrupt marshalling library for Arduino and mbed boards.
Apache License 2.0
122 stars 12 forks source link

Do not yield back to taskmanager in spinlock #29

Closed davetcc closed 3 years ago

davetcc commented 3 years ago

Yielding back to taskmgr in this situation is a recipe to deadlock the bus, as at some point two things get held up waiting for the same lock, and neither can acquire.

Locks are designed for things that are fleeting in scope, IE to control access to shared state for a few microseconds, not for things that last long enough to need yielding.

davetcc commented 3 years ago

reference docs updated to include a warning that yieldForMicros must never be called within a lock.

davetcc commented 3 years ago

This is now valid, I'll update all documentation over the next day or so to match our finds of how it works in heavy use