15 Mar
2006
15 Mar
'06
12:33 a.m.
Isn't this a job for threading.BoundedSpemaphore()?
I don't see how that would work. ISTM that we need an inverse of a BoundedSemaphore. If it understand it correctly, a BS blocks after some pre-set maximum number of acquires and is used for resources with limited capacity (i.e. a number of connections that can be served). With the TaskQueue, there is no pre-set number, the queue can grow to any size, and the join() method will block until the counter falls back to zero. IOW, a BS is about potentially blocking new requests and a TaskQueue is about blocking other work until outstanding requests are complete. Raymond