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

Function kwsysProcessDestroy

Source/kwsys/ProcessWin32.c:1750–1797  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1748}
1749
1750void kwsysProcessDestroy(kwsysProcess* cp, int event)
1751{
1752 int i;
1753 int index;
1754
1755 /* Find the process index for the termination event. */
1756 for (index = 0; index < cp->NumberOfCommands; ++index) {
1757 if (cp->ProcessInformation[index].hProcess == cp->ProcessEvents[event]) {
1758 break;
1759 }
1760 }
1761
1762 /* Check the exit code of the process. */
1763 GetExitCodeProcess(cp->ProcessInformation[index].hProcess,
1764 &cp->CommandExitCodes[index]);
1765
1766 /* Remove from global list of processes. */
1767 kwsysProcessesRemove(cp->ProcessInformation[index].hProcess);
1768
1769 /* Close the process handle for the terminated process. */
1770 kwsysProcessCleanupHandle(&cp->ProcessInformation[index].hProcess);
1771
1772 /* Remove the process from the available events. */
1773 cp->ProcessEventsLength -= 1;
1774 for (i = event; i < cp->ProcessEventsLength; ++i) {
1775 cp->ProcessEvents[i] = cp->ProcessEvents[i + 1];
1776 }
1777
1778 /* Check if all processes have terminated. */
1779 if (cp->ProcessEventsLength == 1) {
1780 cp->Terminated = 1;
1781
1782 /* Close our copies of the pipe write handles so the pipe threads
1783 can detect end-of-data. */
1784 for (i = 0; i < KWSYSPE_PIPE_COUNT; ++i) {
1785 /* TODO: If the child created its own child (our grandchild)
1786 which inherited a copy of the pipe write-end then the pipe
1787 may not close and we will still need the waker write pipe.
1788 However we still want to be able to detect end-of-data in the
1789 normal case. The reader thread will have to switch to using
1790 PeekNamedPipe to read the last bit of data from the pipe
1791 without blocking. This is equivalent to using a non-blocking
1792 read on posix. */
1793 KWSYSPE_DEBUG((stderr, "closing wakeup write %d\n", i));
1794 kwsysProcessCleanupHandle(&cp->Pipe[i].Write);
1795 }
1796 }
1797}
1798
1799DWORD kwsysProcessSetupOutputPipeFile(PHANDLE phandle, char const* name)
1800{

Callers 1

kwsysProcess_WaitForDataFunction · 0.70

Calls 2

kwsysProcessesRemoveFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…