2021-03-24 | Paul Boddie | file changeset files shortlog | Introduced initial pipe support using a special "conserving" page collection which only queues released pages, not issued pages, for reuse, together with dedicated paging coordinators for each pipe. |
paul@65 | 1 | #include "pipe_paging.h" |
paul@65 | 2 | |
paul@65 | 3 | PipePaging::PipePaging() |
paul@65 | 4 | { |
paul@65 | 5 | } |
paul@65 | 6 | |
paul@65 | 7 | /* Add a region to the sequence. */ |
paul@65 | 8 | |
paul@65 | 9 | void PipePaging::add_region(PageMapper *mapper) |
paul@65 | 10 | { |
paul@65 | 11 | _regions.push_back(mapper); |
paul@65 | 12 | } |
paul@65 | 13 | |
paul@65 | 14 | /* Return the first region in the sequence. */ |
paul@65 | 15 | |
paul@65 | 16 | PageMapper *PipePaging::first_region() |
paul@65 | 17 | { |
paul@65 | 18 | return _regions.front(); |
paul@65 | 19 | } |
paul@65 | 20 | |
paul@65 | 21 | /* Return the next region for the reader. If only a single region remains, with |
paul@65 | 22 | the reader wishing to move to the next, return NULL. */ |
paul@65 | 23 | |
paul@65 | 24 | PageMapper *PipePaging::next_region() |
paul@65 | 25 | { |
paul@65 | 26 | if (_regions.size() > 1) |
paul@65 | 27 | { |
paul@65 | 28 | _regions.pop_front(); |
paul@65 | 29 | return _regions.front(); |
paul@65 | 30 | } |
paul@65 | 31 | else |
paul@65 | 32 | return NULL; |
paul@65 | 33 | } |
paul@65 | 34 | |
paul@65 | 35 | // vim: tabstop=4 expandtab shiftwidth=4 |