comp.lang.ada
 help / color / mirror / Atom feed
From: George J <ivanov_george@list.ru>
Subject: Re: Win32. Task or CreateThread
Date: Wed, 3 Aug 2016 19:42:43 -0700 (PDT)
Date: 2016-08-03T19:42:43-07:00	[thread overview]
Message-ID: <349f7cde-2e69-4c4f-8928-ec62cfdaca6c@googlegroups.com> (raw)
In-Reply-To: <nnthgp$ssm$1@gioia.aioe.org>

среда, 3 августа 2016 г., 22:43:25 UTC+3 пользователь Dmitry A. Kazakov написал:
> On 2016-08-03 19:31, George J wrote:
> 
> > Dmitry, I've made some examples,works great!Thanks!And I have one
> > question to understand. Function Gtk.Main.Routers.Init has Delay
> > parameter 0.2 by default.
> 
> Yes, that parameter controls the timer set in the GTK main. It rarely 
> need to be faster because except for running curves (e.g. in an 
> oscilloscope) human eye cannot catch higher frequencies anyway.
> 
> > So, to make my parsing function faster I have
> > to decrease this value to 0.001 or 0.00001, am I right?
> 
> No. 1ms (0.001) is the hard limit for thread switching under Windows 
> anyway, while 10ms is the default. Even a real-time OS would choke at 
> 10us timer interrupts.
> 
> > Or is there any
> > function or solution for more "automatical minimal time delay" without
> > my intervention?
> 
> Usually you accumulate changes and report them at the fixed rate 
> comfortable for the user. E.g. if you have a tight loop:
> 
> declare
>     Last_Time : Time := Clock;
>     This_Time : Time;
> begin
>     loop
>        calculate things ...
> 
>        This_Time := Clock;
>        if This_Time - Last_Time > 0.2 then
>           report state change to the GUI ...
>           Last_Time := This_Time;
>        end if;
>     end loop;
> 
> You might further filter out small changes, e.g. if, say, the progress 
> bar change is under 1%, you ignore it.
> 
> Another technique is to run GUI with its own refresh rate and exchange 
> data through shared object (e.g. protected object or protected by a 
> mutex object).
> 
> -- 
> Regards,
> Dmitry A. Kazakov
> http://www.dmitry-kazakov.de

Ok,Dmitry,thanks a lot!


  reply	other threads:[~2016-08-04  2:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-02 14:38 Win32. Task or CreateThread George J
2016-08-02 15:22 ` Dmitry A. Kazakov
2016-08-02 16:39   ` George J
2016-08-03 17:31   ` George J
2016-08-03 19:43     ` Dmitry A. Kazakov
2016-08-04  2:42       ` George J [this message]
2016-08-05  4:25   ` George J
2016-08-05  6:15     ` George J
2016-08-05  6:17     ` Dmitry A. Kazakov
2016-08-05  6:48       ` George J
2016-08-03 20:31 ` Aurele
2016-08-04  2:41   ` George J
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox