benoitc/socketpool — pull request #11 by cactus (2012-04-30 07:19:33+00:00)
Title: Handle pool.size and pool.max_size values safely

Currently pool.size is not threadsafe. This may not be a problem, but add code to make it safe regarless, using a BoundedSemaphore. A BoundedSemaphore has identical semantics across the current backend modules, so it seemed a reasonable choice as the synchronization primitive.

In addition to more safely handling pool.size, add support for an upper limit on pool members based on the pool.max_size value. In the case where max_size pool size is reached, and tries are exhaused, then raise the connection pool exception.

Finally, provide a unified reap method to reduce duplication of member connection close semantics.

related to issue #10