c++windowscreateprocessiocpwaitformultipleobjects

Detecting exit/failure of child processes using IOCP - C++ - Windows


I have a process manager. It might create thousands (on paper!) of child processes using createprocess function. Currently I'm using mufti-threading and WiatForMultipleObejct in order to detect exit or failure of any of the children.

I was looking for some advice/guideline/pseud-code/link to detect the exit of child process using IOCP if it is possible at all!?

Thanks a lot!


Solution

  • Yes, it's possible.

    You need to take a look at the Job Object API. Specifically you create you process, assign it to a job and then associate the job with a completion port. See JOBOBJECT_ASSOCIATE_COMPLETION_PORT and SetInformationJobObject()