1.1 --- a/page_queue_shared.cc Sun Mar 28 22:38:45 2021 +0200
1.2 +++ b/page_queue_shared.cc Sun Mar 28 22:41:12 2021 +0200
1.3 @@ -1,5 +1,14 @@
1.4 #include "page_queue_shared.h"
1.5
1.6 +
1.7 +
1.8 +/* Discard all queued flexpages. */
1.9 +
1.10 +void PageQueueShared::close(Memory *memory)
1.11 +{
1.12 + discard(_queue, memory);
1.13 +}
1.14 +
1.15 /* Keep waiting for a potential queue non-empty condition.
1.16 Then, attempt to pop an entry from the queue. */
1.17
1.18 @@ -76,26 +85,7 @@
1.19
1.20 bool PageQueueShared::remove(PageOwner *owner, Flexpage *flexpage)
1.21 {
1.22 - std::lock_guard<std::mutex> guard(_lock);
1.23 -
1.24 - Positions::iterator position = _positions.find(flexpage);
1.25 -
1.26 - if (position == _positions.end())
1.27 - return false;
1.28 -
1.29 - /* The found owner may be different from the requesting owner or even NULL
1.30 - if another owner has acquired and then purged its pages. Such a purged
1.31 - flexpage is not immediately usable, however. */
1.32 -
1.33 - Queue::iterator entry = position->second;
1.34 -
1.35 - if ((entry->owner == NULL) || (entry->owner != owner))
1.36 - return false;
1.37 -
1.38 - _queue.erase(entry);
1.39 - _positions.erase(position);
1.40 -
1.41 - return true;
1.42 + return PageQueue::remove(_queue, _positions, owner, flexpage);
1.43 }
1.44
1.45 // vim: tabstop=4 expandtab shiftwidth=4