Improve some timing / thread funcs

This adds delays to some funcs to more accurately reproduce timeouts, and improve tests.

Also fixes some minor issues with alarms and event flags related to how they schedule.

-[Unknown]