Why does my single-threaded flow appear as 2 different threads in the debugger?
I can see main.cpp running on thread 0 in the debugger, but also there are my function calls appearing on thread #7 in the debugger, but these are not calls I am sending to other threads.
Why would they appear there?
Qt will run some threads behind the scenes. It is likely that your function calls are triggered in the GUI, while main.cpp is in the "non-GUI" thread.
Looks like some of the functions are the result of callbacks from a socket connection, so perhaps that is why. This implies to me that I cannot assume there is a synchronous run loop in my program even if I am not manipulating threads directly. For example, I found one bug where apparently a function I directly call was running while a callback was only halfway through a callback function. I didn't even think that was possible. I'd expect one function to complete before another starts, but apparently not so.
Qt is an event-based framework. This means that tasks are performed when the even loop invokes a handler for a given event. Some parts run separately from the event loop to speed things up. So yes, you should not assume your functions run sequentially, especially when using signal and slot connections.