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

Reply via email to