On 07/10/2012 08:28 PM, Peter Hutterer wrote:
Rename to TerminateAndCheck/KillAndCheck to signal that we're waiting for
the process to shut down instead of just sending the respective signals
I realized that perhaps we really should compose the functionalities
rather than combine them into new methods. We would leave Terminate()
and Kill() as they are, but add a WaitForExit() method to Process:
/**
* Wait for the process to exit
*
* @param [in] timeout Timeout to wait for the process to exit
*
* @returns the process exit code, or -1 if the process did not exit
*/
int WaitForExit(unsigned int timeout = 1000);
Then, in Environment::TearDown() we have:
if (d_->server.Terminate() && WaitForExit() >= 0)
return;
std::cerr << "Failed to terminate X server, attempting to kill" <<
std::endl;
if (d_->server.Kill() && WaitForExit() >= 0)
return;
std::cerr << "Failed to kill X server";
What do you think?
-- Chase
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel