| 1 | /* -*- C++ -*- */cxx . . $ `<file>/vendor/Heap-Layers/heaps/threads/lockedheap.h`/ |
| 2 | |
| 3 | /* |
| 4 | |
| 5 | Heap Layers: An Extensible Memory Allocation Infrastructure |
| 6 | |
| 7 | Copyright (C) 2000-2020 by Emery Berger |
| 8 | http://www.emeryberger.com |
| 9 | [email protected] |
| 10 | |
| 11 | Heap Layers is distributed under the terms of the Apache 2.0 license. |
| 12 | |
| 13 | You may obtain a copy of the License at |
| 14 | http://www.apache.org/licenses/LICENSE-2.0 |
| 15 | |
| 16 | */ |
| 17 | |
| 18 | #ifndef HL_LOCKEDHEAP_H |
| 19 | #define HL_LOCKEDHEAP_Hcxx . . $ `vendor/Heap-Layers/heaps/threads/lockedheap.h:19:9`! |
| 20 | |
| 21 | #include <mutex> |
| 22 | #include <cstddef> |
| 23 | |
| 24 | namespace HLcxx . . $ HL/ { |
| 25 | |
| 26 | template <class LockType, class Super> |
| 27 | class LockedHeapcxx . . $ HL/LockedHeap# : public Super { |
| 28 | public: |
| 29 | |
| 30 | enumcxx . . $ HL/LockedHeap#$anonymous_type_0# { Alignmentcxx . . $ HL/LockedHeap#Alignment. = Super::Alignment }; |
| 31 | |
| 32 | inline void * malloccxx . . $ HL/LockedHeap#malloc(bfcfa4d6b7f7ef64). (size_t sz) { |
| 33 | stdcxx . . $ std/::lock_guardcxx . . $ std/lock_guard#<LockType> l (thelockcxx . . $ HL/LockedHeap#thelock.); |
| 34 | return Super::malloc (sz); |
| 35 | } |
| 36 | |
| 37 | inline auto freecxx . . $ HL/LockedHeap#free(b60bee3bf464f7e8). (void * ptr) { |
| 38 | stdcxx . . $ std/::lock_guardcxx . . $ std/lock_guard#<LockType> l (thelockcxx . . $ HL/LockedHeap#thelock.); |
| 39 | return Super::free (ptr); |
| 40 | } |
| 41 | |
| 42 | inline auto freecxx . . $ HL/LockedHeap#free(97bda43a0fe2e735). (void * ptr, size_t sz) { |
| 43 | stdcxx . . $ std/::lock_guardcxx . . $ std/lock_guard#<LockType> l (thelockcxx . . $ HL/LockedHeap#thelock.); |
| 44 | return Super::free (ptr, sz); |
| 45 | } |
| 46 | |
| 47 | inline void * memaligncxx . . $ HL/LockedHeap#memalign(63a7bf2941bfcd7a). (size_t alignment, size_t sz) { |
| 48 | stdcxx . . $ std/::lock_guardcxx . . $ std/lock_guard#<LockType> l (thelockcxx . . $ HL/LockedHeap#thelock.); |
| 49 | return Super::memalign (alignment, sz); |
| 50 | } |
| 51 | |
| 52 | inline size_t getSizecxx . . $ HL/LockedHeap#getSize(fc862ad161026b8c). (void * ptr) const { |
| 53 | stdcxx . . $ std/::lock_guardcxx . . $ std/lock_guard#<LockType> l (thelockcxx . . $ HL/LockedHeap#thelock.); |
| 54 | return Super::getSize (ptr); |
| 55 | } |
| 56 | |
| 57 | inline size_t getSizecxx . . $ HL/LockedHeap#getSize(751e5d26f8574c32). (void * ptr) { |
| 58 | stdcxx . . $ std/::lock_guardcxx . . $ std/lock_guard#<LockType> l (thelockcxx . . $ HL/LockedHeap#thelock.); |
| 59 | return Super::getSize (ptr); |
| 60 | } |
| 61 | |
| 62 | inline void lockcxx . . $ HL/LockedHeap#lock(49f6e7a06ebc5aa8).() { |
| 63 | thelockcxx . . $ HL/LockedHeap#thelock..lock(); |
| 64 | } |
| 65 | |
| 66 | inline void unlockcxx . . $ HL/LockedHeap#unlock(49f6e7a06ebc5aa8).() { |
| 67 | thelockcxx . . $ HL/LockedHeap#thelock..unlock(); |
| 68 | } |
| 69 | |
| 70 | private: |
| 71 | // char dummy[128]; // an effort to avoid false sharing. |
| 72 | LockType thelockcxx . . $ HL/LockedHeap#thelock.; |
| 73 | }; |
| 74 | |
| 75 | } |
| 76 | |
| 77 | #endif |