Look at devices/interface.py
Every single method in the Device object is called in the device thread, with a few exceptions, which are documented (search for thread in that file).
The calibre user interface is in the GUI thread, device operations are in the device thread, so as not to block the UI. The vast majority of device driver code is all executed in the device thread and calibre automatically takes care of dispatching events to the UI thread as appropriate. The few exceptions are documented in interface.py
|