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: border2.nntp.dca.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: GTK and tasking (GNAT) Date: Sat, 03 May 2014 22:23:01 +0100 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx05.eternal-september.org; posting-host="6c8e46900abaabd1a3b7c03d9ac850ff"; logging-data="31379"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18NXtZGw45xJggGjhdoM/SxY6arpBq349o=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (darwin) Cancel-Lock: sha1:4aHFg8lCKMKDXPfw4YEKyFR31pk= sha1:B0dxtMqCctbKMwTlE1IztU9ys7Q= Xref: number.nntp.dca.giganews.com comp.lang.ada:186199 Date: 2014-05-03T22:23:01+01:00 List-Id: hreba writes: > accept StartCounter (txtBox: Gtk.GEntry.Gtk_Entry) do > for i in 1..10 loop > Gtk.GEntry.Set_Text (txtBox, Integer'Image(i)); > Gtk.Widget.Queue_Draw (Gtk.Widget.Gtk_Widget(txtBox)); > delay 0.5; > end loop; > end StartCounter; The calling task (probably the Gtk main loop) blocks while the body of the accept statement is executed. I don't know how this ought to be done in Gtk, though I strongly suspect it's not like that! However, the way to deal with the task problem would normally be to save the values passed with the accept and deal with them afterward: accept StartCounter (txtBox: Gtk.GEntry.Gtk_Entry) do txtBoxCopy := txtBox; end StartCounter; -- Now the caller can carry on while we work with the passed value. for i in 1..10 loop Gtk.GEntry.Set_Text (txtBoxCopy, Integer'Image(i)); Gtk.Widget.Queue_Draw (Gtk.Widget.Gtk_Widget(txtBoxCopy)); delay 0.5; end loop; Questions: is Gtk thread-safe? is Queue_Draw something that should only be called from the Gtk event queue?