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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: border2.nntp.dca1.giganews.com!nntp.giganews.com!newspeer1.nac.net!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!zen.net.uk!dedekind.zen.co.uk!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: How to: communication between multiple tasks using protected objects - with no polling? Date: Wed, 21 Jan 2015 09:28:22 +0100 Organization: cbb software GmbH Message-ID: References: <32208488-3a04-4d2a-8c64-840502dcf96d@googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: YGNMlxhiQ90vAyH0QA4qPw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: number.nntp.giganews.com comp.lang.ada:191968 Date: 2015-01-21T09:28:22+01:00 List-Id: On Tue, 20 Jan 2015 14:36:20 -0800 (PST), Esa Riihonen wrote: > Here is the problem. My typical C-process 'listens' to several FIFOs > connected to separate processes. This is realized using a ppoll-type > 'reactor' - so in essence the process is sleeping until there is some > activity in any of the monitored file descriptors (I guess this is in > essence quite basic arrangement in the 'C-world'). > > I first thought I can implement this by the 'select' - something like this: > > PO1 and PO2 are instantiations of a protected type with entry 'Get'. > > ... > loop > ... > select > PO1.Get(...); > or > PO2.Get(...); > or > ... > end select; > ... > end loop; The typical design of 1-n is reverse: the publisher queues request to the consumer rather than lets the consumer to come and pick it. The publisher may call the consumer's entry or else queue the request into a queue. If publishers shall not be blocked (e.g. in order to prevent priority inversion or due to time constraints), also when it is n-m, use the blackboard instead of a queue. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de