mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-29 20:27:49 +02:00
use memory pool for SSU2 received packets arrays
This commit is contained in:
parent
64e4b3871a
commit
62b811c2c1
3 changed files with 51 additions and 15 deletions
|
@ -131,14 +131,22 @@ namespace util
|
|||
this->Release (t);
|
||||
}
|
||||
|
||||
void ReleaseMt (T * * arr, size_t num)
|
||||
{
|
||||
if (!arr || !num) return;
|
||||
std::lock_guard<std::mutex> l(m_Mutex);
|
||||
for (size_t i = 0; i < num; i++)
|
||||
this->Release (arr[i]);
|
||||
}
|
||||
|
||||
template<template<typename, typename...>class C, typename... R>
|
||||
void ReleaseMt(C<T *, R...>&& c)
|
||||
void ReleaseMt(const C<T *, R...>& c)
|
||||
{
|
||||
std::lock_guard<std::mutex> l(m_Mutex);
|
||||
for (auto& it: c)
|
||||
this->Release (it);
|
||||
}
|
||||
|
||||
|
||||
template<typename... TArgs>
|
||||
std::shared_ptr<T> AcquireSharedMt (TArgs&&... args)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue