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 14:59:51 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: "Matthew Heaney" Newsgroups: comp.lang.ada Subject: Re: How to avoid unreferenced objects (mutexes etc) Date: Wed, 16 Jan 2002 18:04:26 -0500 Organization: Posted via Supernews, http://www.supernews.com 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> X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 X-Complaints-To: newsabuse@supernews.com Xref: archiver1.google.com comp.lang.ada:18988 Date: 2002-01-16T18:04:26-05:00 List-Id: "Darren New" wrote in message news:3C44CFBD.BC1ED52F@san.rr.com... > Sure. Now Op can't act as an entry. I don't understand this comment. Op is a procedure, so by definition it isn't an entry. > The basic problem is that if I have something that says > x.boop > and boop is an entry, I don't understand this comment. Is x a task object, protected object, or something else? How can boop be anything other than an entry? > it can only call one specific piece of code. That > one specific piece of code has to be the one that determines whether the > code blocks. Can you say Boop (X), and then implement operation Boop to have the behavior you want? > 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. I don't understand this comment. If you use the syntax T.op then T must be a task (or protected object). And in that case it's an entry, and so of course it doesn't dispatch. If you had said: "If Op (T) dispatches" then I would understand your question about whether it dispatches. But you didn't, so I'm confused. What's wrong with saying Op (T), and implementing Op as a primitive operation of T? > 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. This is a selective entry call. So wrap it in a dispatching operation: function Op (O : in out T; Timeout : Duration) return Boolean is begin select O.T_Task.Op; return False; or delay Timeout; return True; end select; end Op; Now if you say: Timed_Out := Op (O, 10.0); then you get blocking and dispatching. > 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) Don't use selective accepts in tasks. This is old-fashioned. Rewrite your tasks to make blocking calls to an internal protected object. Have operations communicate with the task by calling the protected object, which wakes up the waiting task.