[fpc-pascal] fpSelect() with very small timeout?

Martin Schreiber fpmse at bluewin.ch
Mon Oct 20 10:19:06 CEST 2008


On Monday 20 October 2008 09.57:35 Graeme Geldenhuys wrote:
> Hi,
>
> Below is some code I use in fpGUI-X11's main event loop. When I played
> around with multithreading, I wrote a simple application, created 4
> threads that each update there own ProgressBar.  I noticed that if I
> don't move the mouse, the ProgressBar gets updated slowly. And when I
> move the mouse over the form, the updates seem more smooth and
> frequent. The default timeout for fpSelect was 1000ms.  I decreased
> that to 50ms and now all GUI updates from the 4 threads are smooth.
> With or without moving the mouse. CPU load also doesn't seem to be
> affected - it's still between 0-1% load.
>
[...]
You could send a wakeup message to the X event queue if a widget has been 
invalidated instead of polling. See MSEgui lib/common/msegui.pas 
tguiapplication.invalidated and the postevent infrastructure for an example.

Martin



More information about the fpc-pascal mailing list