The new std.process is ready for review
Lars T. Kyllingstad
public at kyllingen.net
Sun Feb 24 07:53:48 PST 2013
On Sunday, 24 February 2013 at 15:37:10 UTC, Steven Schveighoffer
wrote:
> On Sun, 24 Feb 2013 10:01:12 -0500, Lars T. Kyllingstad
> <public at kyllingen.net> wrote:
>
>
>> Wait for all processes:
>>
>> This would certainly be convenient, and it is simple to
>> implement. It would require a static __gshared Pid[int] of
>> all processes created by spawnProcess(), and we'd simply call
>> wait() on all of those.
>
> Waiting for ALL processes in an array should be a simple matter
> of some algorithm call.
>
> I didn't see this specific request. I think the request was to
> wait for any process in a specific subset to complete. And
> then of course, the "wait for any process."
Yeah, maybe nobody requested it, and it was just a subconscious
personal desire of mine. I actually had a waitAll() function in
my very first draft, as you may recall. It was only implemented
for POSIX, and it had all the problems mentioned here wrt.
processes not created by spawnProcess(), so you (rightly)
convinced me to remove it.
I even had a waitAny() function in there, which you also (again,
rightly) didn't take kindly to. :)
> Either of these is possible similar to how core.thread keeps
> track of all threads, we could simply ignore any child exits
> that we didn't manage. And I think it's worth implementing at
> some point (this is not an easy problem to solve correctly),
> but not for this release.
I agree, this will be difficult or impossible on POSIX. Calling
wait() and then ignoring the processes we don't care about won't
do, because then we've ruined the chance for other code to call
wait() on those processes.
Lars
More information about the Digitalmars-d
mailing list