I want to stop my process for getting scheduled out for 3-4 statements.
in the sense I want my 3-4 statements to get executed atomically.
ret = waitpid (-1, &live_status, WNOHANG | WUNTRACED);
if(live_ret==0)
{
kill(PIDGET(inferior_ptid),SIGINT);
}
how to achieve it ?
after waitpid's execution....my process should not get scheduled out.
and able to successfully execute kill statement.
Come at this from another direction:
why?
normal processes can't avoid to get scheduled out, and as unix programs work without that capability this is not needed and would indeed be dangerous. but why do you want to do that? if you don't want the child process to run because it could exit and defeat the purpose of the kill(), that doesn't work with SMP anyway: the child could be running on another CPU.
if you just want to make sure the pid still refers to a child and not to another process: if you don't ignore SIGCHLD, the child will survive in half-dead state (as a zombie process) to reserve the pid until the parent process got the pid returned from wait(). if you didn't, your kill() will always hit your child, as intended, it just may me dead anyway.
the problem is: the kill
the problem is:
the kill signal is not issued by the parent, but by debugger.
so precess is not going to get killed rather it is going to be stopped.
what I want is :
after I do
kill(PIDGET(inferior_ptid),SIGINT);
I want to nulify the efect of SIGINT.
in the sense, I should be able to tell kernel, please cancel this kill request.
I do not want to send anymore....
is it possible ?