summaryrefslogtreecommitdiffstats
path: root/src/AllocationPool.h
diff options
context:
space:
mode:
authorJulian Laubstein <julianlaubstein@yahoo.de>2016-02-06 11:37:34 +0100
committerJulian Laubstein <julianlaubstein@yahoo.de>2016-02-06 11:37:34 +0100
commit6fdd7194c81be7234a126bdc3b48f0291fce3567 (patch)
tree7d5ac74b7385ce4ebf77588d80549c884c2b993c /src/AllocationPool.h
parentMerge pull request #2958 from LogicParrot/fence (diff)
parentBulk clearing of whitespace (diff)
downloadcuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar
cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.gz
cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.bz2
cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.lz
cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.xz
cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.zst
cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.zip
Diffstat (limited to 'src/AllocationPool.h')
-rw-r--r--src/AllocationPool.h20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/AllocationPool.h b/src/AllocationPool.h
index 4815ab414..799930708 100644
--- a/src/AllocationPool.h
+++ b/src/AllocationPool.h
@@ -15,23 +15,23 @@ public:
{
public:
virtual ~cStarvationCallbacks() {}
-
+
/** Is called when the reserve buffer starts to be used */
virtual void OnStartUsingReserve() = 0;
-
+
/** Is called once the reserve buffer has returned to normal size */
virtual void OnEndUsingReserve() = 0;
-
+
/** Is called when the allocation pool is unable to allocate memory. Will be repeatedly
called if it does not free sufficient memory */
virtual void OnOutOfReserve() = 0;
};
-
+
virtual ~cAllocationPool() {}
-
+
/** Allocates a pointer to T */
virtual T * Allocate() = 0;
-
+
/** Frees the pointer passed in a_ptr, invalidating it */
virtual void Free(T * a_ptr) = 0;
};
@@ -47,7 +47,7 @@ class cListAllocationPool:
public cAllocationPool<T>
{
public:
-
+
cListAllocationPool(std::unique_ptr<typename cAllocationPool<T>::cStarvationCallbacks> a_Callbacks):
m_Callbacks(std::move(a_Callbacks))
{
@@ -62,7 +62,7 @@ public:
m_FreeList.push_front(space);
}
}
-
+
virtual ~cListAllocationPool()
{
@@ -72,7 +72,7 @@ public:
m_FreeList.pop_front();
}
}
-
+
virtual T * Allocate() override
{
@@ -115,7 +115,7 @@ public:
m_Callbacks->OnEndUsingReserve();
}
}
-
+
private:
std::list<void *> m_FreeList;
std::unique_ptr<typename cAllocationPool<T>::cStarvationCallbacks> m_Callbacks;