comp.lang.ada
 help / color / mirror / Atom feed
From: "Warren W. Gay VE3WWG" <ve3wwg@cogeco.ca>
Subject: Re: multithreading with gtkada
Date: Thu, 14 Nov 2002 12:59:20 -0500
Date: 2002-11-14T12:59:20-05:00	[thread overview]
Message-ID: <3DD3E478.8000407@cogeco.ca> (raw)
In-Reply-To: 3DD3D67A.3060302@cnam.fr

evangeli wrote:
> hi all
> 
> it seems that gtk doesnt support multi-threading (see 
> http://www.faqs.org/faqs/x-faq/part7/section-15.html).

I believe that Gtk does support tasks, but on UNIX platforms,
Gtk will make use of the Xlib (as the ref above shows). This
library I believe is now thread safe on _some_ platforms,
but most certainly NOT on all of them.  I would certainly
not depend upon it for portable code.

> My problem is the following :
> my app opens a windows, which on the show event launch a task wich makes 
> a long computation. The window also contains a cancel button which can 
> be pressed to abort this task.The problem is that i would like this task 
> to make X-Call, and that is apparently not possible and give me 
> unavoidably the following error message:
> ----------------------------------------------
> Xlib: unexpected async reply (sequence 0x9fe)!
> ----------------------------------------------
> i havent found any solution which doesn't use several tasks.
> 
> 1) Am i clear?
> 2) Do u have any idea of a different way to do that?
> 3) why this cruel destiny?
> 
> thanks for any response

Your problem requires some careful Ada programming. You will need
to segment your application so that one or the following
approaches are used:

  - Only one task does Gtk (GUI) operations

or

  - You use an Ada technique to make certain that only one Ada task
    is doing a Gtk operation at any given instance (protected objects
    perhaps).

Sounds like you need the second approach. You can run into the same
situations when trying to use curses (text mode screens).

-- 
Warren W. Gay VE3WWG
http://home.cogeco.ca/~ve3wwg




  reply	other threads:[~2002-11-14 17:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-14 16:59 multithreading with gtkada evangeli
2002-11-14 17:59 ` Warren W. Gay VE3WWG [this message]
2002-11-15 16:25   ` evangeli
2002-11-15 16:08     ` Preben Randhol
2002-11-15 16:22     ` Jean-Pierre Rosen
2002-11-14 18:41 ` David Marceau
2002-11-14 22:00 ` Preben Randhol
replies disabled

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