lkml.org 
[lkml]   [2009]   [Jan]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [4/7] dst: thread pool.
Hi Evgeniy,

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?

> +
> + dprintk("%s: locking list_empty: %d, thread_num: %d.\n",
> + __func__, list_empty(&p->ready_list), p->thread_num);
> +
> + mutex_lock(&p->thread_lock);
> + if (!list_empty(&p->ready_list)) {
> + w = list_first_entry(&p->ready_list,
> + struct thread_pool_worker,
> + worker_entry);
> +
> + dprintk("%s: deleting w: %p, thread_num: %d, list: %p [%p.%p].\n",
> + __func__, w, p->thread_num, &p->ready_list,
> + p->ready_list.prev, p->ready_list.next);
> +
> + p->thread_num--;
> + list_del(&w->worker_entry);
> + }
> + mutex_unlock(&p->thread_lock);
> + }
> +
> + if (w)
> + thread_pool_exit_worker(w);
> + dprintk("%s: deleted w: %p, thread_num: %d.\n",
> + __func__, w, p->thread_num);
> +}


\
 
 \ /
  Last update: 2009-01-14 15:49    [W:0.143 / U:2.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site