2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
5 // $Id: ArenaHeader.icc 470529 2011-11-24 23:54:22Z ssnyder $
7 * @file AthAllocators/ArenaHeader.icc
10 * @brief Proxy for a group of Arenas.
11 * Inline implementations.
19 * @brief Translate an integer index to an Allocator pointer.
20 * @param i The index to look up.
22 * If the index isn't valid, an assertion will be tripped.
25 LockedAllocator ArenaHeader::allocator (size_t i)
28 return m_arena->allocator (i);
30 return m_defaultArena.allocator (i);
35 * @brief Translate an integer index to an Allocator pointer.
36 * @param ctx Use the Arena associated with this event context.
37 * @param i The index to look up.
39 * If the index isn't valid, an assertion will be tripped.
42 LockedAllocator ArenaHeader::allocator (const EventContext& ctx, size_t i)
44 ArenaBase* a = nullptr;
45 size_t slot = ctx.slot();
47 std::lock_guard<std::mutex> lock (m_mutex);
48 if (slot < m_slots.size()) {
52 // Need to release the header lock before creating the allocator;
53 // otherwise we can deadlock (ATR-28749).
55 return a->allocator (i);