Overview
Features
Download
Documentation
Community
Add-Ons & Services

Poco/Process and wait -- an enhancement request

A general discussion forum.

Poco/Process and wait -- an enhancement request

Postby marlowabnp » 08 Jul 2011, 09:59

I would like to see an overloaded wait method on Poco/Process that takes a timeout in milliseconds and a reference to an exit code, i.e.:

bool ProcessHandle::wait(int milliseconds, int& exitCode) const
{
return impl->wait(milliseconds, exitCode);
}

This is quite do-able on Windoze because it can be implemented using WaitForSingleObject that has a timeout parameter.
A POSIX implementation is more tricky since wait does not have a timeout. It just blocks until the child finishes. It can only be interrupted by a signal, which would have to be sent from a thread after it had slept for the timeout period. Well, that's one way to do it anyway. The challenge there would be to pick a signal that is not already being used for something else.

This is an enhancement request so please feel free to put this to the bottom of the pile......what do people think? Would this be useful?

Regards,

Andrew Marlow
marlowabnp
 
Posts: 89
Joined: 08 Nov 2010, 17:29

Re: Poco/Process and wait -- an enhancement request

Postby marlowabnp » 08 Sep 2011, 17:55

I have found that I no longer need this. I fire off a thread that does the launch followed by a wait. When the wait completes it writes to an inter-thread message queue shared with the parent thread. The parent thread can do a timed wait reading from this queue, giving me just what I want.
marlowabnp
 
Posts: 89
Joined: 08 Nov 2010, 17:29


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests