delete_thread() no mutex?

Frank Cusack fcusack at
Wed May 10 09:14:24 CEST 2006

I was wondering why threads.c:thread_pool_clean() doesn't need a mutex
when calling delete_thread().

There is a comment just below that, that a mutex isn't needed to read
"the location" -- which I take to mean thread_pool.active_threads --
as it's only needed to modify the location.

However, just below that, spawn_thread() is called, which does modify
thread_pool.active_threads and a mutex isn't held to do that.

>From a quick read (and late at night), ISTM that this is just an error
in documentation.

a) Only the main thread deals with active_threads and total_threads
   (this is a rough guess, not thoroughly explored)
b) There isn't even a mutex to be locked!  thread_pool has 2 mutexes,
   they are used for different things.

Sound about right?  Or is there indeed some missing locking.

More information about the Freeradius-Devel mailing list