I’m confused about how asyncnotifier works. What exactly is threaded in the notifier? Is the just the watcher threaded? Or does each of the callbacks to the handler functions run on its own thread?
The documentation says essentially nothing about the specifics of the class.
The AsyncNotifier doesn’t use threading, it uses the asynchronous socket handler loop.
If you’re talking about the ThreadedNotifier, then each callback seems to be called in the same thread per notifier.
This means that even if you have several
EventHandlersregistered with someWatchManager, they will all issue callbacks from the same thread.I can’t find where this is explicitly documented, but seems implicit from the generated documentation for the
ThreadedNotifier.loop()method, where it says:…which I took to mean it operates as a fairly simple loop in a single thread, issuing callbacks from that loop.
I have experimented by simply printing the result of
threading.current_thread()in the callbacks, and it verifies this.(You could always file an issue to request more specific documentation if you think that’s warranted.)