comp.lang.ada
 help / color / mirror / Atom feed
From: dennison@telepath.com (Ted Dennison)
Subject: Re: Difficult to describe problem
Date: 21 Jun 2002 08:09:01 -0700
Date: 2002-06-21T15:09:01+00:00	[thread overview]
Message-ID: <4519e058.0206210709.69b73666@posting.google.com> (raw)
In-Reply-To: 3D11C7BA.8040504@uk.thalesgroup.com

Nige <nigel.scott@uk.thalesgroup.com> wrote in message news:<3D11C7BA.8040504@uk.thalesgroup.com>...
> The package is a generic, with a procedure passed as a parameter to
> handle events generated by X. Inside the package is a task which 
> examines the X event list and calls the procedure as required.
...
> The problem is that if I instantiate the windows package and the menu 
> package within the same executable, I end up with two tasks, each 
> processing the X events. This works OK, most of the time, but sometimes 
> one of the task fails during elaboration.
> 
> I have used a protected type declared externally to both packages to 
> single thread the whole thing, but this still doesn't prevent the problem.

X is not thread-safe. This may not be your current problem, but it
*will* cause you problems. If your X bindings don't synchronize
accesses to X, you will have to do it yourself. Typically the easiest
way is to just desginate one task as the X-calling task, and use
protected queues or rendezvous to pass it requests from other tasks
(you will probably need a time-out on either the accept or the X event
wait so neither gets starved).

As for your current problem, without the code its tough to guess. My
guess would be that one of your tasks is trying to use an object
(perhaps the X application context?) before some other task has the
object fully initialized. Putting a "Start_Processing" entry in your
tasks usually solves this kind of problem.



  parent reply	other threads:[~2002-06-21 15:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-20 12:16 Difficult to describe problem Nige
2002-06-20 14:04 ` Dr. Michael Paus
2002-06-20 14:56 ` Stephen Leake
2002-06-21 15:09 ` Ted Dennison [this message]
2002-06-22 18:17   ` Simon Wright
2002-07-08  7:37     ` Nige
replies disabled

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