QTimers spawn new threads every time?
I've got a couple of QTimers that wake my code up once a second to go look for a couple of things, and I noticed that when I do so, gdb is telling me that every time I do so I'm spawning new threads. If I turn the timers off (comment them out), the thread spawning goes away, so I'm pretty sure it is the timers that are doing it...
My gdb output looks like this:
[Thread 0xb4bfcb70 (LWP 9861) exited]
[Thread 0xb53fdb70 (LWP 9860) exited]
[Thread 0xb43fbb70 (LWP 9862) exited]
[New Thread 0xb43fbb70 (LWP 9863)]
[New Thread 0xb53fdb70 (LWP 9864)]
[New Thread 0xb4bfcb70 (LWP 9865)]
[Thread 0xb53fdb70 (LWP 9864) exited]
[Thread 0xb43fbb70 (LWP 9863) exited]
[Thread 0xb4bfcb70 (LWP 9865) exited]
[New Thread 0xb4bfcb70 (LWP 9867)]
[New Thread 0xb43fbb70 (LWP 9868)]
[New Thread 0xb53fdb70 (LWP 9869)]
Is there any reason Qt kills and spawns threads with every timer wait? This seems undesirable to me, is there a way to make QTimers not do this?
AFAIK, QTimer does not use a thread, but you'd have to check the sources for your platform to be sure.
I'm pretty sure that is what is doing. My debugger window will constantly spam those thread exited/thread created messages as long as I have my timers on. If I turn them off, no messages.