umd/external/protobuf-2.6/gtest/fused-src/gtest/gtest-all.cc
int WindowsDeathTest::Wait() {
  if (!spawned())
    return 0;

  // Wait until the child either signals that it has acquired the write end
  // of the pipe or it dies.
  const HANDLE wait_handles[2] = { child_handle_.Get(), event_handle_.Get() };
  switch (::WaitForMultipleObjects(2,
                                   wait_handles,
                                   FALSE,  // Waits for any of the handles.
                                   INFINITE)) {
    case WAIT_OBJECT_0:
    case WAIT_OBJECT_0 + 1:
      break;
    default:
      GTEST_DEATH_TEST_CHECK_(false);  // Should not get here.
  }

  // The child has acquired the write end of the pipe or exited.
  // We release the handle on our side and continue.
  write_handle_.Reset();
  event_handle_.Reset();

  ReadAndInterpretStatusByte();

  // Waits for the child process to exit if it haven't already. This
  // returns immediately if the child has already exited, regardless of
  // whether previous calls to WaitForMultipleObjects synchronized on this
  // handle or not.
  GTEST_DEATH_TEST_CHECK_(
      WAIT_OBJECT_0 == ::WaitForSingleObject(child_handle_.Get(),
                                             INFINITE));
  DWORD status;
  GTEST_DEATH_TEST_CHECK_(::GetExitCodeProcess(child_handle_.Get(), &status)
                          != FALSE);
  child_handle_.Reset();
  set_status(static_cast<int>(status));
  return this->status();
}
// Waits for the child in a death test to exit, returning its exit
// status, or 0 if no child process exists.  As a side effect, sets the
// outcome data member.
Waits for the child in a death test to exit, returning its exit
status, or 0 if no child process exists.  As a side effect, sets the
outcome data member.
Waits for the child in a death test to exit returning its exit status or 0 if no child process exists . As a side effect sets the outcome data member .
int WindowsDeathTest::Wait() {
  if (!spawned())
    return 0;
  const HANDLE wait_handles[2] = { child_handle_.Get(), event_handle_.Get() };
  switch (::WaitForMultipleObjects(2,
                                   wait_handles,
                                   FALSE,  
                                   INFINITE)) {
    case WAIT_OBJECT_0:
    case WAIT_OBJECT_0 + 1:
      break;
    default:
      GTEST_DEATH_TEST_CHECK_(false);  
  }
  write_handle_.Reset();
  event_handle_.Reset();
  ReadAndInterpretStatusByte();
  GTEST_DEATH_TEST_CHECK_(
      WAIT_OBJECT_0 == ::WaitForSingleObject(child_handle_.Get(),
                                             INFINITE));
  DWORD status;
  GTEST_DEATH_TEST_CHECK_(::GetExitCodeProcess(child_handle_.Get(), &status)
                          != FALSE);
  child_handle_.Reset();
  set_status(static_cast<int>(status));
  return this->status();
}
int WindowsDeathTest :: Wait ( ) { if ( ! spawned ( ) ) return 0 ; const HANDLE wait_handles [ 2 ] = { child_handle_ . Get ( ) , event_handle_ . Get ( ) } ; switch ( :: WaitForMultipleObjects ( 2 , wait_handles , FALSE , INFINITE ) ) { case WAIT_OBJECT_0 : case WAIT_OBJECT_0 + 1 : break ; default : GTEST_DEATH_TEST_CHECK_ ( false ) ; } write_handle_ . Reset ( ) ; event_handle_ . Reset ( ) ; ReadAndInterpretStatusByte ( ) ; GTEST_DEATH_TEST_CHECK_ ( WAIT_OBJECT_0 == :: WaitForSingleObject ( child_handle_ . Get ( ) , INFINITE ) ) ; DWORD status ; GTEST_DEATH_TEST_CHECK_ ( :: GetExitCodeProcess ( child_handle_ . Get ( ) , & status ) != FALSE ) ; child_handle_ . Reset ( ) ; set_status ( static_cast < int > ( status ) ) ; return this -> status ( ) ; }
Waits for the child in a death test to exit, returning its exit
status, or 0 if no child process exists.
Waits for the child in a death test to exit returning its exit status or 0 if no child process exists .
// Wait until the child either signals that it has acquired the write end // of the pipe or it dies. // Waits for any of the handles. // Should not get here. // The child has acquired the write end of the pipe or exited. // We release the handle on our side and continue. // Waits for the child process to exit if it haven't already. This // returns immediately if the child has already exited, regardless of // whether previous calls to WaitForMultipleObjects synchronized on this // handle or not.