In article <76fe92$46c$1@platane.wanadoo.fr>, "Jean-Pierre Rosen" wrote: > > James S. Rogers a �crit dans le message > <76dn7b$a35@bgtnsc03.worldnet.att.net>... > >Following is a modest example of what I mean about > >encapsulating a stream in a protected object. > >[snip] > > Unfortunately, all IO operations are potentially > blocking, and therefore not allowed from within a > protected operation. > To get the effect of mutual exclusion for procedures > requiring potentially blocking operations, have a look at > package Protection available from Adalog's components > page (http://perso.wanadoo.fr/adalog/compo2.htm) By the way, JPR here seems to be making the mistake of assuming that stream = stream_io, a common confusion. The original question here related to a particular implementation of streams that you have not seen, and you do not know if it does any potentially blocking operations. Yes, it had to do with file logging, but that does not mean that it does I/O. For example, a perfectly reasonable organization is to have a stream implementation that fills a buffer that is part of a protected type, and a consumer task that empties the buffer and does I/O on it. This organization violates absolutely nothing with regards to doing potentially blocking operations. In Ada 95, if you are following the official design, every single abstraction must be labeled in its spec as to whether it does or does not do PB operations, so that you know if it can be called from a protected operation. Yes, that's frightful from an abstractrion point of view, but that's the way the language is, due to the excessive influence of one particular efficiency-obsessed specific design for possible implementation of protected types. A given implementation of streams (for logging or any other purpose) may or may not do PB operations, and that must be part of its spec. As I commented before, we have essentially extended the language for GNAT by defining that the implementation dependent behavior for PB operations, i.e. the behavior of the compiler for this bounded error, is NOT to reject the PB operation, but to go ahead and do it, with the expected consequences. Robert Dewar Ada Core Technologies -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own