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,629fb94ebc84f06a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-20 07:04:43 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!oleane.net!oleane!fr.clara.net!heighliner.fr.clara.net!newsfeed.vmunix.org!blackbush.xlink.net!blackbush.de.kpnqwest.net!rz.uni-karlsruhe.de!schlund.de!news.online.de!not-for-mail From: "Dr. Michael Paus" Newsgroups: comp.lang.ada Subject: Re: Difficult to describe problem Date: Thu, 20 Jun 2002 16:04:42 +0200 Organization: 1&1 Internet AG Message-ID: <3D11E0FA.2070702@ib-paus.com> References: <3D11C7BA.8040504@uk.thalesgroup.com> NNTP-Posting-Host: p5083086a.dip0.t-ipconnect.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.online.de 1024581883 14249 80.131.8.106 (20 Jun 2002 14:04:43 GMT) X-Complaints-To: abuse@online.de NNTP-Posting-Date: 20 Jun 2002 14:04:43 GMT User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.0) Gecko/20020530 X-Accept-Language: en-us, en Xref: archiver1.google.com comp.lang.ada:26483 Date: 2002-06-20T14:04:43+00:00 List-Id: Nige wrote: > 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. > In Ada95 it is possible to pass an instance of a generic package to another generic package in order to avoid multiple instantiations. Have a look at chapter 12.7 of the Ada95 RM. If I understood your problem description correctly this should help you to avoid the task duplication. Michael