MCPcopy Create free account
hub / github.com/catboost/catboost / Terminate

Method Terminate

util/system/shellcommand.cpp:363–380  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

361 void Run();
362
363 inline void Terminate(int signal) {
364 if (!!Pid && (ExecutionStatus.load(std::memory_order_acquire) == SHELL_RUNNING)) {
365#if defined(_unix_)
366 bool ok = kill(Options_.DetachSession ? -1 * Pid : Pid, signal) == 0;
367 if (!ok && (errno == ESRCH) && Options_.DetachSession) {
368 // this could fail when called before child proc completes setsid().
369 ok = kill(Pid, signal) == 0;
370 kill(-Pid, signal); // between a failed kill(-Pid) and a successful kill(Pid) a grandchild could have been spawned
371 }
372#else
373 Y_UNUSED(signal);
374 bool ok = TerminateProcess(Pid, 1 /* exit code */);
375#endif
376 if (!ok) {
377 ythrow TSystemError() << "cannot terminate " << Pid;
378 }
379 }
380 }
381
382 inline void Wait() {
383 if (WatchThread) {

Callers 2

Y_UNIT_TESTFunction · 0.45
shellcommand.cppFile · 0.45

Calls 2

Y_UNUSEDFunction · 0.85
loadMethod · 0.45

Tested by

no test coverage detected