Re: [boost] Any interest in iostream-like pipe?

2003-08-14 Thread Larry Evans
Alexander Nasonov wrote:

[snip]

The library doesn't use OS pipes. Pipe support is implemented by hand with a 
help of Boost.Threads. Synchronization occurs only in underflow, overflow, 
sync, open and close functions which means fast I/O.
The library also has two capacity models: limited and unlimited. In the 
former case, if writer goes ahead of a reader it stops and waits; in the 
latter case, the writer always allocates new block of memory when overflow 
occurs.
The following post:

http://aspn.activestate.com/ASPN/Mail/Message/boost/1593756

indicates there's some interest in thread-safe access to ostreams at
least.
___
Unsubscribe  other changes: http://lists.boost.org/mailman/listinfo.cgi/boost


[boost] Any interest in iostream-like pipe?

2003-08-14 Thread Alexander Nasonov
All of you know what is pipe and what are iostreams. In this library they 
work together.
Writer-thread put objects into pipes while reader-thread get them from the 
pipe. Ã…lthough objects are copied to/from pipe, this is often a better 
alternative to object sharing because the pipe manages inter-thread 
communication for you. Thus, you can concentrate on domain logic rather 
then on threading primitives.
Unlike OS-provided pipes that operate with bytes of data this library is 
iostream based. It means that you work with objects.
The library doesn't use OS pipes. Pipe support is implemented by hand with a 
help of Boost.Threads. Synchronization occurs only in underflow, overflow, 
sync, open and close functions which means fast I/O.
The library also has two capacity models: limited and unlimited. In the 
former case, if writer goes ahead of a reader it stops and waits; in the 
latter case, the writer always allocates new block of memory when overflow 
occurs.

Example:

// main thread
pipe pp; // limited_capacity by default

// in thread1
opipestream out(pp);
out  data;

// in thread2
ipipestream in(pp);
in  data;

thread1.join();
thread2.join();

reference:
http://groups.yahoo.com/group/boost/files/pipes.zip

-- 
Alexander Nasonov
Remove minus and all between minus and at from my e-mail for timely response


___
Unsubscribe  other changes: http://lists.boost.org/mailman/listinfo.cgi/boost


Re: [boost] Any interest in iostream-like pipe?

2003-08-14 Thread Larry Evans
Larry Evans wrote:
Alexander Nasonov wrote:

[snip]

The following post:

http://aspn.activestate.com/ASPN/Mail/Message/boost/1593756
There's also:

http://lists.boost.org/MailArchives/boost/msg46513.php

indicating some interest in combining thread safety and
decoration.  It seems to me (a novice in threading) that
what needs to be protected is the access to the end
of the pipeline, i.e. the final streambuf, which is
connected to the actual output medium (a file, or console or
pipe).  Hence, I'm wondering if it's a good idea to
combine the two in a ostream class.  I confess I haven't
looked at your code, but I think it would be nice if
somehow it could be streambuf thread safety could be separated
from the {o,i}stream features which are only concerned with
formatting.  Does that make sense?




___
Unsubscribe  other changes: http://lists.boost.org/mailman/listinfo.cgi/boost