From: Stephen D. <sd...@gm...> - 2012-10-27 11:39:07
|
On Fri, Oct 26, 2012 at 11:44 PM, Jeff Rogers <dv...@di...> wrote: > Andrew Piskorski wrote: >> On Fri, Oct 26, 2012 at 08:30:26PM +0100, Stephen Deasey wrote: >> >>> I was thinking it could work something like this: >>> >>> - driver acquires lock, takes first conn thread off queue, releases lock >> >> What if there are no conn threads waiting in the queue? >> > > Same as currently I'd think: the driver holds on to them as waiting > sockets. I think the handling of this is a bit less efficient than > putting them on the conn queue tho, as it creates more work for the > driver to do on every spin and it needs to get woken up once threads are > available. - driver takes the lock, sees that there are no threads in the thread queue, puts conn on the back of the conn queue, does not signal anything, releases the lock - conn thread completes a request, takes the driver lock. -- If the conn queue is empty it puts itself on the front of the thread queue and releases the lock. -- Otherwise it takes then next conn and releases the lock. |