2021-03-27 | Paul Boddie | file changeset files shortlog | Introduced a preallocated memory object alongside the existing incremental allocation object (which has been renamed), both employing a common interface, thus permitting the use of a generic page collection with different page queue types to support both files and pipes. Changed the pipe paging to employ just two pipe regions in order to limit the amount of memory that would be used by each pipe. |
paul@70 | 1 | #pragma once |
paul@70 | 2 | |
paul@70 | 3 | #include "flexpage.h" |
paul@70 | 4 | #include "memory.h" |
paul@70 | 5 | #include "page_owner.h" |
paul@70 | 6 | #include "page_queue.h" |
paul@70 | 7 | |
paul@70 | 8 | |
paul@70 | 9 | |
paul@70 | 10 | /* A page collection. */ |
paul@70 | 11 | |
paul@72 | 12 | class Pages |
paul@70 | 13 | { |
paul@70 | 14 | protected: |
paul@72 | 15 | Memory *_memory; |
paul@70 | 16 | PageQueue *_queue; |
paul@70 | 17 | |
paul@70 | 18 | public: |
paul@72 | 19 | explicit Pages(Memory *memory, PageQueue *queue); |
paul@70 | 20 | |
paul@72 | 21 | explicit Pages(PageQueue *queue); |
paul@70 | 22 | |
paul@72 | 23 | virtual ~Pages() |
paul@70 | 24 | { |
paul@70 | 25 | } |
paul@70 | 26 | |
paul@70 | 27 | virtual Flexpage *remove(); |
paul@70 | 28 | |
paul@70 | 29 | virtual bool reserve(PageOwner *owner, Flexpage *flexpage); |
paul@70 | 30 | |
paul@70 | 31 | virtual Flexpage *flexpage(); |
paul@70 | 32 | |
paul@70 | 33 | virtual void queue(PageOwner *owner, Flexpage *flexpage); |
paul@70 | 34 | |
paul@70 | 35 | virtual void release(Flexpage *flexpage); |
paul@70 | 36 | }; |
paul@70 | 37 | |
paul@70 | 38 | // vim: tabstop=4 expandtab shiftwidth=4 |