Eonblast/Emysql — pull request #25 by ransomr (2012-04-06 17:06:45+00:00)
Title: Fix for Issue 9

This fixes three different race conditions when waiting for connections. The major changes are:
1. Combine locking and adding to the wait queue to one call so that there isn't a window in between.
2. After timeout have the waiting process remove itself from the wait queue. This removes the need to check if the process is still in wait_for_connection, which fixes the original problem reported in Issue 9.
3. Handle race conditions with another process sending the waiting process that timed out a connection by checking if it was able to remove itself from the wait queue. If not, it knows someone else must have sent it a connection and waits for it. (Without this fix the connection would be lost from the pool).
4. Add tests for these issues.