1 /* |
1 /* |
2 * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
44 public: |
44 public: |
45 DirtyCardQueue(PtrQueueSet* qset_, bool perm = false) : |
45 DirtyCardQueue(PtrQueueSet* qset_, bool perm = false) : |
46 // Dirty card queues are always active, so we create them with their |
46 // Dirty card queues are always active, so we create them with their |
47 // active field set to true. |
47 // active field set to true. |
48 PtrQueue(qset_, perm, true /* active */) { } |
48 PtrQueue(qset_, perm, true /* active */) { } |
|
49 |
|
50 // Flush before destroying; queue may be used to capture pending work while |
|
51 // doing something else, with auto-flush on completion. |
|
52 ~DirtyCardQueue() { if (!is_permanent()) flush(); } |
|
53 |
|
54 // Process queue entries and release resources. |
|
55 void flush() { flush_impl(); } |
49 |
56 |
50 // Apply the closure to all elements, and reset the index to make the |
57 // Apply the closure to all elements, and reset the index to make the |
51 // buffer empty. If a closure application returns "false", return |
58 // buffer empty. If a closure application returns "false", return |
52 // "false" immediately, halting the iteration. If "consume" is true, |
59 // "false" immediately, halting the iteration. If "consume" is true, |
53 // deletes processed entries from logs. |
60 // deletes processed entries from logs. |