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,8eff44ec1bcf8433 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-22 09:52:06 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!enews.sgi.com!newspeer2.tds.net!newspeer.radix.net!uunet!ash.uu.net!xyzzy!nntp From: Jeffrey Carter Subject: Re: Container reqs X-Nntp-Posting-Host: e246420.msc.az.boeing.com Content-Type: text/plain; charset=us-ascii Message-ID: <3BD449A4.B3D44645@boeing.com> Sender: nntp@news.boeing.com (Boeing NNTP News Access) Content-Transfer-Encoding: 7bit Organization: The Boeing Company X-Accept-Language: en References: <9qctpn$lil$1@news.huji.ac.il> <3BCC01B1.18C18C98@free.fr> <3BCC6CB7.20BAA30D@boeing.com> <9r0fbp$l5t$1@shell.monmouth.com> Mime-Version: 1.0 Date: Mon, 22 Oct 2001 16:30:28 GMT X-Mailer: Mozilla 4.73 [en]C-CCK-MCD Boeing Kit (WinNT; U) Xref: archiver1.google.com comp.lang.ada:15032 Date: 2001-10-22T16:30:28+00:00 List-Id: Kenneth Almquist wrote: > > When using a queue for interprocess communication, you normally want a > reader task to block when the queue is empty. You probably want the > writer to block when the queue is full, though it is easier to imagine > exceptions to this. The natural way to accomplish this in Ada is to > wrap the queue in a protected type with appropriate entry barriers, as > is shown in the code at the end of this posting. If you do this, the > semantics for protected types mean that the queue will never be > accessed by two tasks simultaneously, so there is no need for the > queue type to be "threadsafe." Yes, the protected queue component will normally be implemented using an unprotected queue component. This is such a common idiom that any library that doesn't supply such components will not help much in providing standardization (instead of everyone having to provide his own component, everyone will have to provide his own protected component). Indeed, I rarely use unprotected components except when constructing more complex data structures, even when developing sequential systems. The overhead of the protected object is generally not an issue. -- Jeffrey Carter