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,6009c73a58f787a0 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-01-16 08:37:05 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!hub1.nntpserver.com!headwall.stanford.edu!newsfeed.stanford.edu!canoe.uoregon.edu!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: How to avoid unreferenced objects (mutexes etc) Date: 16 Jan 2002 11:35:45 -0500 Organization: NASA Goddard Space Flight Center Message-ID: References: <3c3ee8c8.105408250@News.CIS.DFN.DE> <3c429d1c.2624281@News.CIS.DFN.DE> <3C445F34.44697AEF@san.rr.com> <3C44CFBD.BC1ED52F@san.rr.com> NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1011199197 24751 128.183.220.71 (16 Jan 2002 16:39:56 GMT) X-Complaints-To: dscoggin@cne-odin.gsfc.nasa.gov NNTP-Posting-Date: 16 Jan 2002 16:39:56 GMT User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 Xref: archiver1.google.com comp.lang.ada:18972 Date: 2002-01-16T16:39:56+00:00 List-Id: Darren New writes: > > > As an example, if your task is coded without any guards on the entries, > > > there's no way for a child of T to add a guard. > > > > But couldn't a derived type NT extend T to include a protected object (that > > implements a semaphore, say), that could be used by types in NT'Class to do > > the same thing? > > That's not guarding an entry. If T.op dispatches, then it can't be an > entry. If it's an entry, I can't override it. Hmm. Entries with guards only occur in protected objects, not tasks (unless I'm really confused). So I'll assume we are talking about protected objects here. It's true that an entry (in either a task or a protected object) can be dispatching. But you can provide a guard in the parent task, that uses a function that is dispatching: entry Foo (...) when T.Bar; This appears to be legal when T.Bar is dispatching, but I've never tried it. > I can't do select T.op or delay 10.0 ; yadda end select; and have > T.op be one of two different pieces of code, for example. True. > The problem I had was trying to build a library wherein the > framework instantiates a number of tasks. Each task is provided by > the user of the framework. (Think, for example, of someone writing > multiple types of windows in a GUI framework.) Each task would need > to respond to different events at different times (meaning selective > accepts in the tasks) and the framework wanted to not have to know > what all these different task types are (meaning dispatching). > Couldn't figure out how to do it properly. Wound up building a > kludge that basically involved manually marshalling all the messages > and queueing them, and generally reimplementing the entry queue > mechanism in Ada. Maybe you can invert this; define the tasks in the framework code, with a standard set of entries, but have each entry call a function via dispatching, and allow the user to override those functions. This is the structure used by Borland's Object Windows Library. > > I haven't found a need for extensible tasks. > > I have, but then that's the kind of software I write. To be precise, you have a need for dispatching in a tasking context, and tried a design approach that doesn't work in Ada. There are other approaches; if one of them works, you have not found a need for extensible tasks :). -- -- Stephe