This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Updated patch for Bug 13217 - thread apply all detach throws a SEGFAULT


>>>>> "Ali" == ali anwar <ali_anwar@codesourcery.com> writes:

Ali> +static int
Ali> +thread_valid (struct thread_info *tp)
Ali> +{
Ali> +  struct thread_info  *utp;
Ali> +  for (utp = thread_list; utp; utp = utp->next)
Ali> +     if (tp == utp)
Ali> +       return 1;
Ali> +  return 0;
Ali> +}

Ali> +  for (tp = thread_list; thread_valid(tp); tp = tp->next)

It seems like this introduces quadratic behavior here.
I think it would be better to avoid this.

Ali> +	if (thread_count() == 0)
Ali> +	  break;

Here too.

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]