1 #pragma once 2 3 #include <systypes/base.h> 4 5 #include <list> 6 #include <mutex> 7 8 #include "memory.h" 9 10 11 12 /* A memory pool abstraction. */ 13 14 class MemoryPreallocated : public Memory 15 { 16 protected: 17 std::mutex _lock; 18 std::list<Region *> _regions; 19 20 Memory *_memory; 21 offset_t _amount; 22 23 public: 24 explicit MemoryPreallocated(Memory *memory, offset_t amount); 25 26 explicit MemoryPreallocated(); 27 28 virtual Region *region(); 29 30 virtual offset_t region_size() 31 { return _memory->region_size(); } 32 33 virtual void release(Region *region); 34 }; 35 36 // vim: tabstop=4 expandtab shiftwidth=4