Re: workqueue_drain

2017-12-27 Thread Ryota Ozaki
ion more versatile than just a drain function. >> >> Oh I got it. Well, that should work for my cases (bridge, pppoe) because >> there is just one work. I'm not sure the API suits for other use cases. >> >> Anyway I'm trying to implement the API (workqueue_

Re: workqueue_drain

2017-12-21 Thread Ryota Ozaki
e work. I'm not sure the API suits for other use cases. > > Anyway I'm trying to implement the API (workqueue_wait?). Here it is: http://www.netbsd.org/~ozaki-r/workqueue_wait.diff I think that workqueue_drain based on workqueue_wait would be that workqueue_drain prepares a local work, enqueu

Re: workqueue_drain

2017-12-21 Thread Ryota Ozaki
t;> such as mutex and condvar only for that purpose. >>> >>> workqueue itself can provide an API to help the routine. >>> It, say workqueue_drain, waits for all pending works to >>> finish. With it the caller needs to only ensure that no >>> new work will

Re: workqueue_drain

2017-12-21 Thread Ryota Ozaki
On Thu, Dec 21, 2017 at 5:58 AM, Michael van Elst wrote: > ozak...@netbsd.org (Ryota Ozaki) writes: > >>On Wed, Dec 20, 2017 at 8:06 PM, Michael van Elst wrote: >>> What about a method that waits for a specific work to complete? > >>It might be useful but

Re: workqueue_drain

2017-12-20 Thread Joerg Sonnenberger
On Thu, Dec 21, 2017 at 05:32:58AM +0800, Paul Goyette wrote: > I'm not totally convinced here. It might be useful to wait for a > particular work to be finished in order to allow it to be enqueued > again (no work can be enqueued if already in the queue). But I don't > see how "remember the

Re: workqueue_drain

2017-12-20 Thread Michael van Elst
On Thu, Dec 21, 2017 at 05:32:58AM +0800, Paul Goyette wrote: > again (no work can be enqueued if already in the queue). But I don't > see how "remember the last work enqueued and wait for it to be done > before destroying" is more versatile than "waiting for all to be done > before destroying".

Re: workqueue_drain

2017-12-20 Thread Paul Goyette
On Wed, 20 Dec 2017, Michael van Elst wrote: ozak...@netbsd.org (Ryota Ozaki) writes: On Wed, Dec 20, 2017 at 8:06 PM, Michael van Elst wrote: What about a method that waits for a specific work to complete? It might be useful but how it works in this case? You

Re: workqueue_drain

2017-12-20 Thread Michael van Elst
ozak...@netbsd.org (Ryota Ozaki) writes: >On Wed, Dec 20, 2017 at 8:06 PM, Michael van Elst wrote: >> What about a method that waits for a specific work to complete? >It might be useful but how it works in this case? You could remember the last work enqueued and wait for it

Re: workqueue_drain

2017-12-20 Thread Ryota Ozaki
On Wed, Dec 20, 2017 at 8:06 PM, Michael van Elst wrote: > ozak...@netbsd.org (Ryota Ozaki) writes: > >>Here is a patch: >> http://www.netbsd.org/~ozaki-r/workqueue_drain.diff >>(I will update workqueue.4 once the proposal is accepted.) > > What about a method that waits for

Re: workqueue_drain

2017-12-20 Thread Michael van Elst
ozak...@netbsd.org (Ryota Ozaki) writes: >Here is a patch: > http://www.netbsd.org/~ozaki-r/workqueue_drain.diff >(I will update workqueue.4 once the proposal is accepted.) What about a method that waits for a specific work to complete? -- -- Michael van Elst

Re: workqueue_drain

2017-12-20 Thread Ryota Ozaki
t;> such as mutex and condvar only for that purpose. >>> >>> workqueue itself can provide an API to help the routine. >>> It, say workqueue_drain, waits for all pending works to >>> finish. With it the caller needs to only ensure that no >>> new work will

Re: workqueue_drain

2017-12-20 Thread Ryota Ozaki
called. Currently users of workqueue have >> to ensure the contract by theirselves. It's possible >> but it may need to add extra synchronization mechanisms >> such as mutex and condvar only for that purpose. >> >> workqueue itself can provide an API to help the routi

Re: workqueue_drain

2017-12-20 Thread Paul Goyette
On Wed, 20 Dec 2017, Paul Goyette wrote: KASSERT_MSG((wq->wg_flags & WQ_DRAINING) != 0, "adding work to a draining workqueue") And, of course, that should have been ==, not != :) +--+--++ | Paul Goyette

Re: workqueue_drain

2017-12-19 Thread Paul Goyette
synchronization mechanisms such as mutex and condvar only for that purpose. workqueue itself can provide an API to help the routine. It, say workqueue_drain, waits for all pending works to finish. With it the caller needs to only ensure that no new work will be enqueued. Here is a patch: http

workqueue_drain

2017-12-19 Thread Ryota Ozaki
and condvar only for that purpose. workqueue itself can provide an API to help the routine. It, say workqueue_drain, waits for all pending works to finish. With it the caller needs to only ensure that no new work will be enqueued. Here is a patch: http://www.netbsd.org/~ozaki-r/workqueue_drain.diff (I