fix exit handling

This commit is contained in:
Stefani Seibold 2015-05-04 12:42:08 +02:00
parent 8eb2424e8f
commit 8060b8ef7f
2 changed files with 10 additions and 24 deletions

View File

@ -1327,32 +1327,23 @@ struct process *process_new(pid_t pid, unsigned int swap_endian, unsigned int tr
}
void process_show_exit(struct process *process)
{
if (options.client || (!options.client && !options.verbose))
fprintf(options.output, "+++ process %d exited +++\n", process->pid);
}
void process_exit(struct process *process)
{
process_show_exit(process);
process_set_status(process, MT_PROCESS_EXIT);
if (options.client || (!options.client && !options.verbose))
fprintf(options.output, "+++ process %d exited +++\n", process->pid);
if (!options.interactive)
_process_dump(process, sort_allocations, skip_zero_allocations, options.output);
}
void process_about_exit(struct process *process)
{
if (options.auto_scan) {
process_show_exit(process);
process_set_status(process, MT_PROCESS_EXITING);
process_set_status(process, MT_PROCESS_EXITING);
if (options.auto_scan)
process_leaks_scan(process, SCAN_ALL);
}
else {
process_exit(process);
client_send_msg(process, MT_EXIT, NULL, 0);
}
}
void process_detach(struct process *process)

13
event.c
View File

@ -173,17 +173,12 @@ static void show_exit(struct task *task)
static struct task *handle_about_exit(struct task *task)
{
show_exit(task);
if (task->leader == task)
report_about_exit(task);
if (task->leader == task) {
if (report_about_exit(task) != -1)
return task;
remove_proc(task);
}
else
remove_task(task);
continue_task(task, 0);
return NULL;
return task;
}
static struct task *handle_exit(struct task *task)