summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-12-28 16:39:03 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2015-12-28 16:39:03 +0000
commitfa50ec225a747ee614f973b6e9c87b3826716834 (patch)
treef29b321007514bb7e69c570e7f1e94ab174a202c
parentAdd support for querying semaphore value (diff)
downloadlibadhocutil-fa50ec225a747ee614f973b6e9c87b3826716834.tar.bz2
libadhocutil-fa50ec225a747ee614f973b6e9c87b3826716834.tar.xz
libadhocutil-fa50ec225a747ee614f973b6e9c87b3826716834.zip
Add support for querying resource pool free count
-rw-r--r--libadhocutil/resourcePool.h2
-rw-r--r--libadhocutil/resourcePool.impl.h8
2 files changed, 10 insertions, 0 deletions
diff --git a/libadhocutil/resourcePool.h b/libadhocutil/resourcePool.h
index f77f2a5..9d8c625 100644
--- a/libadhocutil/resourcePool.h
+++ b/libadhocutil/resourcePool.h
@@ -75,6 +75,8 @@ namespace AdHoc {
unsigned int inUseCount() const;
/// Get number of available cached resources.
unsigned int availableCount() const;
+ /// Get number of free slots.
+ unsigned int freeCount() const;
protected:
/// Create a new resource instance to add to the pool.
diff --git a/libadhocutil/resourcePool.impl.h b/libadhocutil/resourcePool.impl.h
index b421e62..b5d7e2f 100644
--- a/libadhocutil/resourcePool.impl.h
+++ b/libadhocutil/resourcePool.impl.h
@@ -162,6 +162,14 @@ namespace AdHoc {
}
template <typename R>
+ unsigned int
+ ResourcePool<R>::freeCount() const
+ {
+ SharedLock(lock);
+ return poolSize.freeCount();
+ }
+
+ template <typename R>
ResourceHandle<R>
ResourcePool<R>::getMine()
{