Messages in this thread | | | Date | Sun, 10 Mar 2013 05:46:32 -0700 | From | Tejun Heo <> | Subject | Re: [PATCH 14/31] workqueue: replace POOL_MANAGING_WORKERS flag with worker_pool->manager_mutex |
| |
Hello, Lai.
On Sun, Mar 10, 2013 at 06:09:38PM +0800, Lai Jiangshan wrote: > > - if (pool->flags & POOL_MANAGING_WORKERS) > > + if (!mutex_trylock(&pool->manager_mutex)) > > return ret; > > > > - pool->flags |= POOL_MANAGING_WORKERS; > > > if mutex_trylock(&pool->manager_mutex) fails, it does not mean > the pool is managing workers. (although current code does). > so I recommend to keep POOL_MANAGING_WORKERS.
So, that's the intention. It's gonna be used during pool destruction and we want all the workers to think that the pool is being managed and it's safe to proceed.
> I suggest that you reuse assoc_mutex for your purpose(later patches). > (and rename assoc_mutex back to manager_mutex)
They are different. assoc_mutex makes the workers wait for the managership, which shouldn't happen during pool destruction. We want the workers to assume that the pool is managed which is what manager_mutex achieves.
Thanks.
-- tejun
| |