MCPcopy Create free account
hub / github.com/awslabs/aws-lambda-cpp / Wait

Method Wait

tests/gtest/gtest-all.cc:8277–8315  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

8275// status, or 0 if no child process exists. As a side effect, sets the
8276// outcome data member.
8277int WindowsDeathTest::Wait() {
8278 if (!spawned())
8279 return 0;
8280
8281 // Wait until the child either signals that it has acquired the write end
8282 // of the pipe or it dies.
8283 const HANDLE wait_handles[2] = { child_handle_.Get(), event_handle_.Get() };
8284 switch (::WaitForMultipleObjects(2,
8285 wait_handles,
8286 FALSE, // Waits for any of the handles.
8287 INFINITE)) {
8288 case WAIT_OBJECT_0:
8289 case WAIT_OBJECT_0 + 1:
8290 break;
8291 default:
8292 GTEST_DEATH_TEST_CHECK_(false); // Should not get here.
8293 }
8294
8295 // The child has acquired the write end of the pipe or exited.
8296 // We release the handle on our side and continue.
8297 write_handle_.Reset();
8298 event_handle_.Reset();
8299
8300 ReadAndInterpretStatusByte();
8301
8302 // Waits for the child process to exit if it haven't already. This
8303 // returns immediately if the child has already exited, regardless of
8304 // whether previous calls to WaitForMultipleObjects synchronized on this
8305 // handle or not.
8306 GTEST_DEATH_TEST_CHECK_(
8307 WAIT_OBJECT_0 == ::WaitForSingleObject(child_handle_.Get(),
8308 INFINITE));
8309 DWORD status_code;
8310 GTEST_DEATH_TEST_CHECK_(
8311 ::GetExitCodeProcess(child_handle_.Get(), &status_code) != FALSE);
8312 child_handle_.Reset();
8313 set_status(static_cast<int>(status_code));
8314 return status();
8315}
8316
8317// The AssumeRole process for a Windows death test. It creates a child
8318// process with the same executable as the current process to run the

Callers

nothing calls this directly

Calls 2

GetMethod · 0.80
ResetMethod · 0.80

Tested by

no test coverage detected