Terminate all (grand)children when terminating a child process

后端 未结 1 1385
抹茶落季
抹茶落季 2021-01-03 05:05

I will jump right in, to be brief and descriptive:

C++, Windows API

I am creating child processes using CreateProcess to run external (command-l

1条回答
  •  被撕碎了的回忆
    2021-01-03 05:56

    You can use Job objects to kill all the processes as a unit. You create a job object via the CreateJobObject API, and assign a process to it with AssignProcessToJobObject. New processes created by a process in a job object belong to the same job object by default. Calling TerminateJobObject will terminate all associated processes in the job object.

    0 讨论(0)
提交回复
热议问题