MCPcopy Create free account
hub / github.com/Kitware/CMake / SpawnBuildDaemon

Method SpawnBuildDaemon

Source/cmInstrumentation.cxx:844–870  ·  view source on GitHub ↗

* Called by ctest --start-instrumentation. * * This creates a detached process which waits for the parent process (i.e., * the build system) to die before running the postBuild hook. In this way, the * postBuild hook triggers after every invocation of the build system, * regardless of whether the build passed or failed. */

Source from the content-addressed store, hash-verified

842 * regardless of whether the build passed or failed.
843 */
844int cmInstrumentation::SpawnBuildDaemon()
845{
846 // Do not inherit handles from the parent process, so that the daemon is
847 // fully detached. This helps prevent deadlock between the two.
848 uv_disable_stdio_inheritance();
849
850 // preBuild Hook
851 if (this->LockBuildDaemon()) {
852 // Release lock before spawning the build daemon, to prevent blocking it.
853 this->buildLock.Release();
854 this->CollectTimingData(cmInstrumentationQuery::Hook::PreBuild);
855 }
856
857 // postBuild Hook
858 auto ppid = uv_os_getppid();
859 if (ppid) {
860 std::vector<std::string> args;
861 args.push_back(cmSystemTools::GetCTestCommand());
862 args.push_back("--wait-and-collect-instrumentation");
863 args.push_back(this->binaryDir);
864 args.push_back(std::to_string(ppid));
865 auto builder = cmUVProcessChainBuilder().SetDetached().AddCommand(args);
866 auto chain = builder.Start();
867 uv_run(&chain.GetLoop(), UV_RUN_DEFAULT);
868 }
869 return 0;
870}
871
872// Prevent multiple build daemons from running simultaneously
873bool cmInstrumentation::LockBuildDaemon()

Callers 1

mainFunction · 0.80

Calls 12

LockBuildDaemonMethod · 0.95
CollectTimingDataMethod · 0.95
to_stringFunction · 0.85
push_backMethod · 0.80
GetLoopMethod · 0.80
uv_os_getppidFunction · 0.50
uv_runFunction · 0.50
ReleaseMethod · 0.45
AddCommandMethod · 0.45
StartMethod · 0.45

Tested by 1

mainFunction · 0.64