How to sleep procesing GUI events?

Hi rooters,

I need to do something like

 if(eof1 || eof2){gSystem->Sleep(500); f.clear(); continue;} //wait before next events will be flushed by producer

but Sleep() freezes out GUI events processing. Would be possible instead
to do:

 if(eof1 || eof2){ for(int i=0;i<100000;i++) gSystem->ProcessEvents(); f.clear(); continue;} //wait before next events will be flushed by producer

This approach requires calculation of end_of_loop number, and more, the time
will be dependent on CPU clock.

Hence the question: is there something like gSystem->SleepWithProcessing(500) ?

Hi Kirill,

There is no method gSystem->SleepWithProcessing(500), but the codegSystem->Sleep(500); gSystem->ProcessEvents(); will do what you need instead. Let me know if this help.

Cheers, Ilka

No, it does not. Sleep() freeses the system for half a second, so if this situation is repeated
continiously, then the GUI is almost stuck. So far i go with

for(int i=0;i<1000000;i++)
  gSystem->ProcessEvents();

It works.

But would be nice to have some special feature like for example
gSystem->ProcessEvents(300) with the meaning: during this 300 msec do nothing but
process GUI events.

Is it possible to implement?

Hello,

I found this topic when I was looking for a solution for the same problem. I think we can avoid the Sleep() use thanks to a Timer.

Pierre-Louis