1

Under windows I can use WaitForMultipleObjects. Is there a way to do something in QT? What I want to do is: wait for an event to occur (QWaitCondition) while be able to react for instance to an abort request.

MiB_Coder
  • 865
  • 1
  • 7
  • 20
  • If you wait for events (including an abort event) it sounds right to communicate using a queue for events which are processed in the thread. Every Qt thread has an event queue to which you can `postEvent`s: https://stackoverflow.com/questions/4093159/what-is-the-correct-way-to-implement-a-qthread-example-please – Jens Mar 23 '18 at 22:55
  • I understand the concept that QThread allows you to emit a signal, which is processed in a slot running in a different thread. However this is actually not the design pattern I want to use here. – MiB_Coder Mar 24 '18 at 17:26
  • I don#'t mean signal or slots but `postEvent`. I am assuming that your thread basically is a worker thread that an event, e.g. a work package, processes it and waits for the next event. I would usually implement this with a thread-safe queue, similar to Go's channel, but Qt implements this already. – Jens Mar 24 '18 at 17:33
  • Or send your thread command objects over a queue. – Jens Mar 24 '18 at 17:45

0 Answers0