1

This is my scenario: I have a dll (with Qt in the back-end, and with no event loop started). I am able to perform the signal-slot communication with-in this dll (there is a only one thread). I would like to use the facilities of QFileSystemWatcher in this dll. But it looks like, QFileSystemWatcher starts its own thread, and it is not able to communicate to my main thread since there is no event process.

So, basically I need a way to start the event processing without being blocked !

László Papp
  • 51,870
  • 39
  • 111
  • 135
  • What exactly are you trying to achieve with QFileSystemWatcher? Also, there is no "Qt Event Process". You may be looking for `QEventLoop`. In any case, it will block, but depending on the exact use case, it may be red herring. – László Papp Dec 26 '13 at 04:37
  • Yes, it is the main event loop. I would like to use QFileSystemWatcher facilities to get updated when there is any change in a particular file. I can use it to re-read the file. – Saroj Patro Dec 26 '13 at 04:45
  • Well, my dll is used as an API, which means I don't want to block and every thing was on a single thread. That is the reason there were no Event loop created by it. – Saroj Patro Dec 26 '13 at 04:51

1 Answers1

0

So, basically I need a way to start the event processing without being blocked !

So, basically you want to use QEventLoop features without using the QEventLoop based on the comment discussion. The QEventLoop has to be "blocking", inherently, in order to actually have an event loop.

You could always create a "blocking" thread with the event loop inside, but then your signal-slot management might be tied to that particular thread.

This is not the usual way of using an event loop, but depending on your concrete scenario, it might be sufficient in this special case.

László Papp
  • 51,870
  • 39
  • 111
  • 135
  • Will creating another thread with its own event loop be a possible solution ? This thread based loop will be blocked to process inputs/events from user but the main thread will work unblocked. – Saroj Patro Dec 26 '13 at 06:06