[PATCH xorg-gtest v2 6/8] xserver: move Terminate and Kill handling here

Chase Douglas chase.douglas at canonical.com
Wed Jul 11 12:15:53 PDT 2012


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


More information about the xorg-devel mailing list