comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Win32. Task or CreateThread
Date: Wed, 3 Aug 2016 21:43:14 +0200
Date: 2016-08-03T21:43:14+02:00	[thread overview]
Message-ID: <nnthgp$ssm$1@gioia.aioe.org> (raw)
In-Reply-To: ee3e42ae-2301-4a1c-80c7-8ece0f97dd54@googlegroups.com

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

  reply	other threads:[~2016-08-03 19:43 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 [this message]
2016-08-04  2:42       ` George J
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