From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Win32. Task or CreateThread Date: Wed, 3 Aug 2016 21:43:14 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <5f464ccd-c532-4b4d-8f45-9f29ba41a326@googlegroups.com> NNTP-Posting-Host: xelDFTENDI+dlkJFd2Ot2w.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:31277 Date: 2016-08-03T21:43:14+02:00 List-Id: 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