Files
Claude 9835f5ee2b Support multiple concurrent IntervalTimers (Teensy parity)
The previous implementation used a single static SIGALRM handler and one
ITIMER_REAL, so a second IntervalTimer silently clobbered the first
despite the API documenting up to 4 simultaneous timers.

Reimplement with one std::thread per active timer, each invoking its
callback at the requested period via sleep_until. A static slot counter
caps concurrent timers at 4 (matching the Teensy 4.x PIT channels);
begin() returns false once all 4 are in use, and end() frees the slot.
update() retimes the next interval, and a self-end() from within a
callback detaches rather than joining to avoid deadlock.

Because the library now uses std::thread, src/CMakeLists.txt links
Threads::Threads PUBLIC so consumers (e.g. test/blink) link pthread
transitively. Adds a test/bugs regression test covering four concurrent
timers, the max-4 limit, and slot reuse after end().

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FAsvzgsaayj2nbZnnQGAav
2026-06-24 20:08:25 +00:00
..
2025-02-16 12:47:32 +00:00
2025-02-16 12:47:32 +00:00