Boost logo

Boost :

From: Boris (boriss_at_[hidden])
Date: 2008-09-01 14:41:36


On Mon, 01 Sep 2008 17:44:56 +0200, Ion Gaztañaga <igaztanaga_at_[hidden]>
wrote:

> Boris wrote:
>>> -> Using named pipes has been problematic because it returns errors
>>> when launching multiple processes aggressively: Error 231 - All Pipes
>>> are Busy. This does not happen with anonymous pipes and I think it has
>>> some relationship with the guid code. By the way, I think a uuid
>>> library is too much to create a unique identifier to be shared with
>>> the child a simple atomic count would to the job in my opinion. That
>>> would reduce Boost.Process dependencies.
>> An atomic count might not be sufficient as it would be unique only per
>> process. As I used Boost.Uuid only for convenience though I'll replace
>> it with an atomic count plus a random number to drop the dependency.
>
> The PID of the parent plus an atomic count wouldn't be enough?

I had the same idea first. But as the pipe class doesn't know the PID in
the process class I thought a random number should be fine, too. However
we can call of course getpid() and a Windows function if you prefer not to
use a random number.

>>> -> systembuf::close() should call sync() to push the last charaters
>>> into the pipe, othewise, characters are lost if the user does not
>>> flush the stream.
>> Changed (in postream::close()).
>
> I think we must change this in systembuf, because a user might use the
> streambuf directly and it would be surprised to see that unlike
> std::filebuf, already written characters are missed.

Ah, I thought it was a typo as there is no close() method in systembuf. As
systembuf is derived from std::streambuf which doesn't provide close()
either I was pretty sure you meant postream::close()?

Boris


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk