comp.lang.ada
 help / color / mirror / Atom feed
From: MCL <boris@lml.ls.fi.upm.es>
Subject: Re: Problem with gtkada and tasks
Date: 31 Jul 2001 02:40:04 +0200
Date: 2001-07-31T00:40:06+00:00	[thread overview]
Message-ID: <7x1ymylymz.fsf@balboa.dia.fi.upm.es> (raw)
In-Reply-To: 3B659207.CE169E3@softhome.net


> 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 ||




  reply	other threads:[~2001-07-31  0:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-25  8:53 Problem with gtkada and tasks Carlos Aganzo
2001-07-26 16:07 ` Ted Dennison
2001-07-27  8:16   ` Carlos Aganzo
2001-07-27 12:31     ` Manuel Carro
2001-07-30 16:57 ` David Monterroso Cabello
2001-07-31  0:40   ` MCL [this message]
2001-07-31 11:17   ` Frank
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox