2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
6 //____________________________________________________________________
7 inline char* LWPool::acquire()
9 std::scoped_lock lock (m_mutex);
10 char * c = (m_likelyNonEmptyArea?m_likelyNonEmptyArea->acquire():0);
11 return c ? c : searchAcquire();
15 //____________________________________________________________________
16 inline bool LWPool::belongsInArea(char*c,LWPoolArea*a) const
18 return c>reinterpret_cast<char*>(a) && c<reinterpret_cast<char*>(a)+m_growsize;
21 //____________________________________________________________________
22 inline void LWPool::release(char*c)
24 std::scoped_lock lock (m_mutex);
25 assert(!m_likelyReleaseArea||(m_likelyReleaseArea->belongsInArea(c)==belongsInArea(c,m_likelyReleaseArea)));
26 if (!m_likelyReleaseArea||!belongsInArea(c,m_likelyReleaseArea))
27 m_likelyReleaseArea = findArea(c);
28 assert(m_likelyReleaseArea);
29 m_likelyReleaseArea->release(c);
30 if (m_likelyReleaseArea->isUnused()&&!isMotherPool()) {//NB: Mother pool never releases!!!!
31 // cppcheck-suppress thisUseAfterFree; xxx check this!
32 freeArea(m_likelyReleaseArea);