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-Thread: 103376,8af9e3a438ec928a X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!transit.nntp.hccnet.nl!newsfeeder.wxs.nl!transit.news.xs4all.nl!195.241.76.212.MISMATCH!tiscali!transit1.news.tiscali.nl!dreader2.news.tiscali.nl!not-for-mail Newsgroups: comp.lang.ada Subject: Re: process blocking References: <41400af9$1@dnews.tpgi.com.au> <41404385$1@dnews.tpgi.com.au> From: Ludovic Brenta Date: Thu, 09 Sep 2004 20:09:12 +0200 Message-ID: <873c1rtiuv.fsf@insalien.org> User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) Cancel-Lock: sha1:Sgok/0anb3ZEX+dzz7qJTY6kZZA= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Organization: Tiscali bv NNTP-Posting-Date: 09 Sep 2004 20:11:08 CEST NNTP-Posting-Host: 83.134.238.215 X-Trace: 1094753468 dreader2.news.tiscali.nl 62383 83.134.238.215:33153 X-Complaints-To: abuse@tiscali.nl Xref: g2news1.google.com comp.lang.ada:3542 Date: 2004-09-09T20:11:08+02:00 List-Id: "P Hull" writes: > Oh i was not looking for a static solution. pMain is visible to all > tasks p1..pn. The first task (i.e. one of p1..pn based upon some > timing mechanism) will rendezvous with pMain and seizes pMain. And > once pi has finished whatever it wants to do with pMain, some other > task within p1..pn will then next rendezvous with pMain and seize > it, and once finished .. etc etc > > I know this should be simple to implement. Thanks for any help Why does pMain have to be a task? Could it not be a protected object instead? Then, the task pi would call a procedure or entry in the protected object. While that procedure or entry is executing, other tasks that also want to execute a procedure or entry in pMain must wait. Here is an example: protected pMain is procedure Seize_And_Do_Whatever; private Protected_Data : Integer; end pMain; protected body pMain is procedure Seize_And_Do_Whatever is begin Protected_Data := 42; end Seize_And_Do_Whatever; end pMain; Now, any task pi can call pMain.Seize_And_Do_Whatever. The processing takes place in the task pi; pi is not blocked. If another task, pj, wants to call pMain.Seize_And_Do_Whatever, it waits. See the reference manual section 9.4 for more details. [1] http://www.adaic.org/standards/ada95.html [2] http://www.adaic.org/standards/95lrm/html/RM-9-4.html -- Ludovic Brenta.