Re: [4/7] dst: thread pool.

Evgeniy Polyakov
2009-01-14T15:02:01Z

Hi Frederik.

Thanks for the comment!

On Wed, Jan 14, 2009 at 03:46:02PM +0100, Frederik Deweerdt (frederik.deweerdt@xprog.eu) wrote:
> On Wed, Jan 14, 2009 at 02:05:30AM +0300, Evgeniy Polyakov wrote:
> [...]
> > +void thread_pool_del_worker(struct thread_pool *p)
> > +{
> > + struct thread_pool_worker *w = NULL;
> > +
> > + while (!w) {
> > + wait_event(p->wait, !list_empty(&p->ready_list) || !p->thread_num);
> ^^^^^^^^^^^^^^
> What's the purpose of !p->thread_num here? Is there an exit case missing
> in the loop below?

It is needed if thread was not in the ready_list but existed because of
some global flag. Current code does not use simultaneous exit and this
function is entered only when there are threads in the pool, so it
should be correct. But if called by several threads, it should be an
exit condition. I will put it into the loop termination check for the
completeness.

--
Evgeniy Polyakov