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=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d38d76f108979fc7 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-07-30 18:05:07 PST From: MCL Newsgroups: comp.lang.ada Subject: Re: Problem with gtkada and tasks Date: 31 Jul 2001 02:40:04 +0200 Organization: Computer Science Department, Technical U. of Madrid, Spain Message-ID: <7x1ymylymz.fsf@balboa.dia.fi.upm.es> References: <3b5e88ee.10782754@news.bt.es> <3B659207.CE169E3@softhome.net> NNTP-Posting-Host: pinocho5.fi.upm.es Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: panoramix.fi.upm.es 996540006 5077 138.100.8.116 (31 Jul 2001 00:40:06 GMT) X-Complaints-To: news@panoramix.fi.upm.es NNTP-Posting-Date: 31 Jul 2001 00:40:06 GMT User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!194.25.134.62!newsfeed00.sul.t-online.de!t-online.de!news-ge.switch.ch!news.rediris.es!news-2.rediris.es!138.100.251.9.MISMATCH!news.upm.es!panoramix.fi.upm.es!not-for-mail Xref: archiver1.google.com comp.lang.ada:10799 Date: 2001-07-31T00:40:06+00:00 List-Id: > So I'm going to try, in my poor english, to fully explain it: Practice makes perfect. > The purpose of the program is to create a simulation in which a cell > is represented by an Ada95 task, and it is capable of replicating by > itself. I do not know if this is a requirement of the problem. In any case, although this is conceptually valid, isn't a bit of a waste? Unless you really want to let cells "live" at a rate which is not set by you, but by the underlying scheduler. The final restult, I am afraid, can be disappointing. On the other hand you just call a thread-unprotected Gtk.Main.Main while other tasks update the graphical objects. This is highly unreliable! Chances are that concurrent updates will corrupt the shared data. Go to the GtkAda user & reference manual, look up "tasking". > --Y tenemos que hacerlo usando el soporte de threads de gtkada. SU > PUTA MADRE. Yes, that is right. You have to take care of concurrent updates. Note that even if you update the state within a protected object, the Main loop is *not* in exclusive access. As I pointed out before, the only reliable way to do this I've found is to make every Gtk-related operation from within the *same task*. OTOH, I am not an experienced Gtk/Ada programmer, so there may be a simpler way. -- || Manuel Carro -- DLSIIS || || e-mail: mcarro@fi.upm.es || || http://lml.ls.fi.upm.es/~boris || || http://clip.dia.fi.upm.es/Software/Ciao || || Phone: +34 91 336-7455 FAX: +34 91 336-7412 ||