Subject: Re: workqueue(9), per-CPU queues (part 2)
To: None <tech-kern@netbsd.org>
From: Mindaugas R. <rmind@NetBSD.org>
List: tech-kern
Date: 07/26/2007 01:25:20
While here...
I was thinking about adding few functions to the API. Currently, there are no
correct way to handle if work was done. What about adding something like this:

  int workqueue_wait(struct workqueue *wq, u_int timo);

It would wait while work will be processed (or timeout occurs, if set) i.e.
cv_timedwait() and cv_broadcast() in the worker. These would be called only if
some WQ_USINGWAIT flag would be set.

  bool wokqueue_empty(struct workqueue *wq);

Checks if queue is empty. Maybe instead of this, something like
workqueue_count() would be better (to get the count of active works).

Would this be reasonable? Or it adds too much additional overhead, and should
be implemented in the caller's structure?

-- 
Best regards,
Mindaugas
www.NetBSD.org