Qt6 topics merged with General

Receiving signals into a QThread without calling exec()

  • Is it possible to have a QThread without a Qt event loop and somehow manually poke the Qt event delivery mechanism to deliver any events sent to the thread?

    E.g. a run method that looks something like this:

    @while (true)

    I'm wondering whether it's possible to have a worker thread which can listen for signals but without handing over control to exec().

    (For some background, this is in the context of an audio callback thread where I don't have control over when I get called.)

  • I guess you could try that. You could try what happens if you run processEvents() regulary in your thread. That is, in its basics, what an eventloop does too. I have not tried this myself, and I would not recommend it in general.

Log in to reply