gtk and system



This may not be a gtk problem, but let me explain my problem.  I have an 
GTK+ application which starts processes using fork and execle, which works 
great.  I save the process id (pid) of that process .  Later on, a user 
pushes a button called 'stop tasks' and when called it concatenates the 
'kill' command with the saved pid.  Below is some basic code.
When I try to kill the processes I started the system command does not 
return an error code but the process consistently goes into a <defunct> 
mode instead of dying.  However, when I leave my GTK+ application, the 
<defunct> process does die.  But why not immediately.  Is this a gtk 
problem, or a UNIX limitation or is the fact that I started the processes 
with the GTK application cause some sort of a parent - child relationship. 
 Thanks ahead of time for your help.

sprintf(process_id,"%d",tasks->task_list[row].process_id);
strcpy(executable,"kill -9 ");
strcat(executable,process_id);

  system(process_id);





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]