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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a0224dc3d1e52f3d X-Google-Attributes: gid103376,public From: eachus@spectre.mitre.org (Robert I. Eachus) Subject: Re: Streams and Concurrency Date: 1998/12/30 Message-ID: #1/1 X-Deja-AN: 427254662 References: <76dhm3$rkq$1@nnrp1.dejanews.com> Organization: The Mitre Corp., Bedford, MA. Newsgroups: comp.lang.ada Date: 1998-12-30T00:00:00+00:00 List-Id: In article stt@houdini.camb.inmet.com (Tucker Taft) writes: > Furthermore, to support non-blocking read, you would need to add some > kind of marker into the stream itself, I suspect, to be placed between > "top-level" objects in the stream. Then, when you call the non-blocking > "read" or "input" routine of the instance of this generic package, > it would call a routine of the underlying stream which would indicate > whether there is an "entire" top-level object already buffered up. > If not, the non-blocking read/input routine of the generic would > return a "not available" indicator. If there is an entire top-level > object buffered up, the read/input routine would use the corresponding > stream attribute to read the data from the stream, confident that it > wouldn't block or get an end-of-file indication during the read. Since the non-blocking read would have to do read ahead to find the marker, the marker doesn't really add anything. So you really only need two sets of entries, one which does blocking read and writes, and one set which is non-blocking. HOWEVER, the routines underlying the Read operations for interprocessor communication and I/O streams will have to be defined in terms of Stream_Elements, because you will have to not only do read ahead, but you will have to save the read ahead material in another (in memory) stream. Note that this is an somewhat special pattern. It is only of interest in the presence of tasking and either multiple processors or the like. And while it can easily be written in portable Ada 95, it is one where low-level implementation support can significantly improve performance. -- Robert I. Eachus with Standard_Disclaimer; use Standard_Disclaimer; function Message (Text: in Clever_Ideas) return Better_Ideas is...