c++ - expected duration between kill and the ability to reap with waitpid -


i have linux app must spawn child process on request 1 of exec() functions.

if child process has not finished before it's time spawn again, app must kill previous instance before starting new one. with

kill(pid, sigterm); 

i'm keeping pid of previous instance , using

waitpid(pid, &status, wnohang) 

to reap process.

it seems there's extremely long time window (possibly hundreds of milliseconds) between issuing kill call , being able reap process waitpid.

what cause this? thought unless child process set signal hander (this 1 doesn't) killed virtually immediately. on 200mhz arm9 still ... seems odd me.

the process may catch sigterm in order perform own cleanup before shutting down.

even if doesn't, don't know how long it'll take os shut down process.

trying rely on things fool's errand.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -