provide available connections

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37985 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2014-07-07 16:01:22 +00:00
parent e9e530123c
commit 8faf0731ec
2 changed files with 22 additions and 0 deletions

View file

@ -1424,6 +1424,10 @@ SQLCLIENT_PRIVATE
NSTimeInterval _failWaits; /** Time waiting for timewouts */
}
/** Returns the count of currently available connections in the pool.
*/
- (int) availableConnections;
/**
* Creates a pool of clients using a single client configuration.<br />
* Calls -initWithConfiguration:name:pool: (passing NO to say the client

View file

@ -56,6 +56,24 @@
@implementation SQLClientPool
- (int) availableConnections
{
int available;
int index;
[self _lock];
available = index = max;
while (index-- > 0)
{
if (YES == u[index])
{
available--;
}
}
[self _unlock];
return available;
}
- (void) dealloc
{
SQLClient **clients;