comp.lang.ada
 help / color / mirror / Atom feed
From: Nige <nigel.scott@uk.thalesgroup.com>
Subject: Difficult to describe problem
Date: Thu, 20 Jun 2002 13:16:58 +0100
Date: 2002-06-20T12:16:15+00:00	[thread overview]
Message-ID: <3D11C7BA.8040504@uk.thalesgroup.com> (raw)

Hi - Sorry about the ambiguous title of this post, but it's hard to sum 
up the problem.

What I have is a simple Ada interface to the Xlib function which 
contains functions for creating windows, and drawing in them, etc.

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.

I also have another generic package which provides a menu by 
instantiating it with an enumeration type and another procedure. This 
menu package uses the above window package to create a window and fill 
it with the elements of the enumeration type. When one of the items is 
clicked on, the procedure is called.

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.

Ideally, I'd like to integrate the menu package into the window package 
so that they both use the same event loop (task) which I think will cure 
the problem.

The final problem I have is how to integrate it. If the menu package 
remains generic, it can't be called by the task. If I make it non 
generic, I can't specify an enumeration for the menu when it is created.

What I'd really like to do is to make the menu package a non generic and 
somehow pass an enumeration type to it. If not I'll have to pass a list 
of pointers to strings or something.

Sorry for the long post - any ideas welcommed.

Nige.




             reply	other threads:[~2002-06-20 12:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-20 12:16 Nige [this message]
2002-06-20 14:04 ` Difficult to describe problem Dr. Michael Paus
2002-06-20 14:56 ` Stephen Leake
2002-06-21 15:09 ` Ted Dennison
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