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: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!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: Fri, 23 Jan 2015 09:25:14 +0100 Organization: cbb software GmbH Message-ID: <16hj52m3z7o4u$.89sc4sp3d4eo$.dlg@40tude.net> References: <87a91c0xpq.fsf@adaheads.sparre-andersen.dk> <1x7jndf8up05d.1n1l3ck15y1lf.dlg@40tude.net> <204973896443655271.096946nonlegitur-futureapps.invalid@reader80.eternal-september.org> 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: news.eternal-september.org comp.lang.ada:24712 Date: 2015-01-23T09:25:14+01:00 List-Id: On Thu, 22 Jan 2015 21:52:17 +0000 (UTC), G.B. wrote: > "Dmitry A. Kazakov" wrote: >> On Wed, 21 Jan 2015 19:56:17 +0100, Jacob Sparre Andersen wrote: > >>> To me it sounds like a single protected object for storing the state of >>> all the workers (students) makes most sense. The workers can push in >>> their most recent state through a (common) protected procedure. The >>> master (teacher) blocks on a protected entry until at least one worker >>> has updated its state. >> >> Right, though this works only with a single subscriber (the teacher). >> Usually there are more than one . > > The PO and the teacher task(s) could share a suspension > object (one for each teacher). When the PO has collected > enough items, it calls Set_True on some suspension > object to wake the teacher task up. You missed the point. The scenario I was talking about is a queue, e.g. a FIFO, which can be implemented using a PO. But a queue is fundamentally a n-1 scenario, because getting an element from the queue is a destructive operation, it changes the queue state. In fact, the queue's state is the state of the subscriber. With multiple subscribers there is no way to tell which one's state is the queue state. You need the get operation idempotent and have the subscribers keeping the states of their own. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de