Identifying thread/process termination