Merge pull request #169 from tchaloupka/connpool_unlockOnErr

Unlock ConnectionPool on failure
This commit is contained in:
Sönke Ludwig 2019-07-31 22:38:37 +02:00 committed by GitHub
commit 7c609dd07f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -74,6 +74,8 @@ final class ConnectionPool(Connection)
debug assert(m_thread is () @trusted { return Thread.getThis(); } (), "ConnectionPool was called from a foreign thread!"); debug assert(m_thread is () @trusted { return Thread.getThis(); } (), "ConnectionPool was called from a foreign thread!");
() @trusted { m_sem.lock(); } (); () @trusted { m_sem.lock(); } ();
scope (failure) () @trusted { m_sem.unlock(); } ();
size_t cidx = size_t.max; size_t cidx = size_t.max;
foreach( i, c; m_connections ){ foreach( i, c; m_connections ){
auto plc = c in m_lockCount; auto plc = c in m_lockCount;