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

Function kwsysProcess_Interrupt

Source/kwsys/ProcessUNIX.c:1411–1440  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1409}
1410
1411void kwsysProcess_Interrupt(kwsysProcess* cp)
1412{
1413 int i;
1414 /* Make sure we are executing a process. */
1415 if (!cp || cp->State != kwsysProcess_State_Executing || cp->TimeoutExpired ||
1416 cp->Killed) {
1417 return;
1418 }
1419
1420 /* Interrupt the children. */
1421 if (cp->CreateProcessGroup) {
1422 if (cp->ForkPIDs) {
1423 for (i = 0; i < cp->NumberOfCommands; ++i) {
1424 /* Make sure the PID is still valid. */
1425 if (cp->ForkPIDs[i]) {
1426 /* The user created a process group for this process. The group ID
1427 is the process ID for the original process in the group. */
1428 kill(-cp->ForkPIDs[i], SIGINT);
1429 }
1430 }
1431 }
1432 } else {
1433 /* No process group was created. Kill our own process group.
1434 NOTE: While one could argue that we could call kill(cp->ForkPIDs[i],
1435 SIGINT) as a way to still interrupt the process even though it's not in
1436 a special group, this is not an option on Windows. Therefore, we kill
1437 the current process group for consistency with Windows. */
1438 kill(0, SIGINT);
1439 }
1440}
1441
1442void kwsysProcess_Kill(kwsysProcess* cp)
1443{

Callers 1

runChild2Function · 0.70

Calls

no outgoing calls

Tested by 1

runChild2Function · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…