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: dennison@telepath.com Subject: Re: Streams and Concurrency Date: 1998/12/30 Message-ID: <76e2rl$a4b$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 427200246 References: <76dhm3$rkq$1@nnrp1.dejanews.com> X-Http-Proxy: 1.0 x5.dejanews.com:80 (Squid/1.1.22) for client 204.48.27.130 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Wed Dec 30 20:36:04 1998 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.5 [en] (WinNT; I) Date: 1998-12-30T00:00:00+00:00 List-Id: In article , stt@houdini.camb.inmet.com (Tucker Taft) wrote: > It seems clear that the stream attributes do not directly support the > logging from multiple tasks, with interleaving occurring only > between "top-level" objects, as desired by this application. > Furthermore, they don't support reading without waiting. > > However, it should be simple enough to build a generic package > which provides the desired functionality. > > Each current "top-level" use of a stream attribute in the application > would be changed to be a call on a "read/write" or "input/output" routine of an > appropriate instance of this generic package. Such a routine would > acquire a lock on the stream, invoke the corresponding stream attribute, > and release the lock. Ahhh. Now that might do the trick. Thanks a lot! It hadn't occurred to me that generics can call the attributes too. Of course if your clients would prefer the attribute interface this is a problem. But I don't see that being too much of an issue. > 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, Yes, exactly. The problem is there's no way for the reader to know where "between" is without first trying to read the entire object. Even within the same data structure, the size could change depending on the value of a tag or variant (or some other user-defined critera). The only way I could see to do it is to have the writer put the length of the object in the stream *at the front* of the object *after* the object is written. Doing this requires some kind of direct access into the stream, and a way of blocking reads until the whole object is written. Otherwise the reader could read that size data out of the stream before the writer has a chance to fill it in. My problem with doing the above was that it also requires the whole-object locking of the stream (which you have just explained one way to handle). -- T.E.D. -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own