Author: rfm
Date: Mon Jul 7 18:01:22 2014
New Revision: 37985
URL: http://svn.gna.org/viewcvs/gnustep?rev=37985&view=rev
Log:
provide available connections
Modified:
libs/sqlclient/trunk/SQLClient.h
libs/sqlclient/trunk/SQLClientPool.m
Modified: libs/sqlclient/trunk/SQLClient.h
URL:
http://svn.gna.org/viewcvs/gnustep/libs/sqlclient/trunk/SQLClient.h?rev=37985&r1=37984&r2=37985&view=diff
==============================================================================
--- libs/sqlclient/trunk/SQLClient.h (original)
+++ libs/sqlclient/trunk/SQLClient.h Mon Jul 7 18:01:22 2014
@@ -1424,6 +1424,10 @@
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
Modified: libs/sqlclient/trunk/SQLClientPool.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/sqlclient/trunk/SQLClientPool.m?rev=37985&r1=37984&r2=37985&view=diff
==============================================================================
--- libs/sqlclient/trunk/SQLClientPool.m (original)
+++ libs/sqlclient/trunk/SQLClientPool.m Mon Jul 7 18:01:22 2014
@@ -55,6 +55,24 @@
@end
@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
{
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs