Henry Jen wrote:
William A. Rowe, Jr. wrote:
Henry Jen wrote:
In a way they work the same. But there are a few interesting
differences:
1. Set the unused max does not force the thread to stop, an unused
thread kills itself when it becomes idle and realize there are enough
idle threads. Thus no joining or any locking issue for using this
function.
Is it reasonable to do a quick reap when max() is adjusted? E.g. if the
freecount > max then call reap?
Reasonable. Might not be optimal, but makes more sense. I feel it's kind
of like async and sync debate.
By jove I think I've got it...
adjust max() as planned. Don't reap. Drop stop_unused_threads, and in it's
place, add an apr_thread_pool_idle_maintenance() function, which promises to
either ramp up free threads if below the free thread min() threshold, or ask
some threads to die if above free thread max() threshold.
The easiest way to kill is to scedule a noop() work assignment to the waiting
thread, and when noop() exits, it counts threads and decides it's time for it's
death.
Bill