delete_thread() no mutex?

Alan DeKok aland at nitros9.org
Wed May 10 18:49:04 CEST 2006


Frank Cusack <fcusack at fcusack.com> wrote:
> spawn_thread() modifies total_threads, not active_threads, so this is ok.
> (AFAICT total_threads is only used by the main thread.)
> active_threads is protected by the queue mutex (should probably be better
> documented), and in that case I agree with the comment in t_p_clean().
> Alan or someone please confirm or argue.

  Yes.

> But I have a new question.  thread_pool_addrequest() uses active_threads
> to determine if it should spawn, but it doesn't hold the queue mutex.
> So it could err either way.  I'd argue that the log message can be
> bogus but if you're that much against the limit it doesn't matter.
> There should just be a comment there about possible stale value.

  OK.

> And one last question.  Why does total_active_threads walk the entire
> thread pool?  It should just return active_threads.  Either way it
> can return a stale value.

  Yes, it shouldn't walk the the thread pool.

  Alan DeKok.



More information about the Freeradius-Devel mailing list