Well, the typical way to trigger asynchronous events is to use the signal
module. As the documentation notes, signals cannot be used for inter-thread communication, so threads would be inappropriate in this case. Of course, you can also use threads using threading.Condition
objects.
That being said, asynchronous events, threads, and signals are confusing and hard to implement correctly. Are you sure you want to reinvent the wheel? (You very well might be; I just like to check.) If not, watchdog
provides the exact capabilities you require.