UI Threading question

Hi

I have a question about assumptions I can make in threading.

I’m assuming if I am running with N threads for the audio, there is still only 1 thread for the UI.

From that am I safe to conclude the following

  1. Menu Callbacks (the onAction in a ui::MenuItem) and other UI actions (onHover, onClick, etc) happen in the UI thread and are single threaded
  2. ModuleWidget constructors (not Module constructors, but ModuleWidget constructors) happen in the UI thread and are single threaded (non-overlapping) with each other and with Menu Callbacks (and other UI actions)

So I have an interaction between a collection of things in ModuleWidget which are called through UI actions (like a menu item) and state set in destructors and constructors of ModuleWidget, I don’t have to worry about threadedness.

Obviously modules are different as is the audio process function.

Thanks as always!

Yes, all GUI things happen on the main thread. This is true with Rack for DAWs as well.

Thanks! I figured but safer to ask than to have random crashes. And as always, appreciate the rapid response.