FACT++
1.0
Main Page
Related Pages
Namespaces
Classes
Files
Examples
void MemoryStock::push
(
const std::shared_ptr< char > &
mem
)
inline
private
Definition at line
81
of file
MemoryManager.h
.
82
{
83
if
(!mem)
84
return
;
85
86
// Decrease the amont of memory in use accordingly
87
fInUse
-=
fChunkSize
;
88
89
// If the maximum memory has changed, we might be over the limit.
90
// In this case: free a slot
91
if
(
fAllocated
>
fMaxMemory
)
92
{
93
fAllocated
-=
fChunkSize
;
94
return
;
95
}
96
97
{
98
const
std::lock_guard<std::mutex> lock(
fMutexMem
);
99
fMemoryStock
.emplace_front(mem);
100
}
101
102
{
103
const
std::lock_guard<std::mutex> lock(
fMutexCond
);
104
fCond
.notify_one();
105
}
106
}
MemoryStock::fMutexMem
std::mutex fMutexMem
Definition:
MemoryManager.h:29
MemoryStock::fCond
std::condition_variable fCond
Definition:
MemoryManager.h:31
MemoryStock::fMaxMemory
size_t fMaxMemory
Definition:
MemoryManager.h:22
MemoryStock::fInUse
size_t fInUse
Definition:
MemoryManager.h:24
MemoryStock::fMemoryStock
std::forward_list< std::shared_ptr< char > > fMemoryStock
Definition:
MemoryManager.h:33
MemoryStock::fAllocated
size_t fAllocated
Definition:
MemoryManager.h:25
MemoryStock::fChunkSize
size_t fChunkSize
Definition:
MemoryManager.h:21
MemoryStock::fMutexCond
std::mutex fMutexCond
Definition:
MemoryManager.h:30
MemoryStock
Generated on Sun Sep 18 2016 20:50:54 for FACT++ by
1.8.11