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 X-Received: by 10.237.35.174 with SMTP id j43mr57939323qtc.29.1470245492955; Wed, 03 Aug 2016 10:31:32 -0700 (PDT) X-Received: by 10.157.56.165 with SMTP id p34mr256974otc.6.1470245492904; Wed, 03 Aug 2016 10:31:32 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!c52no6779254qte.1!news-out.google.com!d130ni23634ith.0!nntp.google.com!f6no7097264ith.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 3 Aug 2016 10:31:32 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=109.252.108.241; posting-account=YB4WOgoAAABLG9D7qoJiPBc6EJSzsPDF NNTP-Posting-Host: 109.252.108.241 References: <5f464ccd-c532-4b4d-8f45-9f29ba41a326@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Win32. Task or CreateThread From: George J Injection-Date: Wed, 03 Aug 2016 17:31:32 +0000 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 3860 X-Received-Body-CRC: 1464744224 Xref: news.eternal-september.org comp.lang.ada:31275 Date: 2016-08-03T10:31:32-07:00 List-Id: =D0=B2=D1=82=D0=BE=D1=80=D0=BD=D0=B8=D0=BA, 2 =D0=B0=D0=B2=D0=B3=D1=83=D1= =81=D1=82=D0=B0 2016 =D0=B3., 18:23:00 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7= =D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Dmitry A. Kazakov =D0=BD=D0=B0= =D0=BF=D0=B8=D1=81=D0=B0=D0=BB: > On 2016-08-02 16:38, George J wrote: > > Hi All!I have Windows GUI application (GTK) with very busy proc calling= by clicking button, > > like > > ---------- > > procedure Test_Busy is > > begin > > for K in 1..10000000 loop > > Ada.TextIO.Pul_Line(K'Img); > > end loop; > > end Test_Busy; > > --------- > > And I want to make this procedure not to "freeze" window while > > executing. I have an experience with CreateThread winapi, and all will > > be ok, and window will be dragable while running procedure Test_Busy. > > I've only read about tasking and I've tried yet to do some with it. And > > I can't understand its mechanism. Is it creates a new thread in Windows > > when executing? And will I get the effect like calling CreateThread? Th= anks. >=20 > Under Windows with GNAT the effect of task creation is one of a thread. >=20 > Since you are using GTK be aware that GTK is not thread-safe. You may=20 > not call any GTK (also GLib, GObject etc) operations from a thread/task= =20 > that does not run the main GTK loop. >=20 > So if you want the task to report back to GTK in any way (e.g. by moving= =20 > the progress bar) you must do it by communicating with the task running= =20 > the main loop. You can find an example how do do this here: >=20 > http://www.dmitry-kazakov.de/ada/gtkada_contributions.htm#1.1 >=20 > Note that even if the task does not report back, you will need some kind= =20 > of communication, at least in order to be able to end the process when=20 > the task is still active. In Ada the master task awaits completion of=20 > other tasks. Thus from the GTK's destroy handler you might wish to tell= =20 > your second task to kill itself. Otherwise the effect will be that the=20 > application window will be closed by the process will linger until the=20 > task completes. >=20 > --=20 > Regards, > Dmitry A. Kazakov > http://www.dmitry-kazakov.de 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 de= fault. So, to make my parsing function faster I have to decrease this value= to 0.001 or 0.00001, am I right? Or is there any function or solution for = more "automatical minimal time delay" without my intervention? Hope I under= standable with my english/