1 /* |
1 /* |
2 * Copyright (c) 2001, 2013, 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. |
29 #include "runtime/mutex.hpp" |
29 #include "runtime/mutex.hpp" |
30 #include "runtime/mutexLocker.hpp" |
30 #include "runtime/mutexLocker.hpp" |
31 #include "runtime/thread.inline.hpp" |
31 #include "runtime/thread.inline.hpp" |
32 |
32 |
33 PtrQueue::PtrQueue(PtrQueueSet* qset, bool perm, bool active) : |
33 PtrQueue::PtrQueue(PtrQueueSet* qset, bool perm, bool active) : |
34 _qset(qset), _buf(NULL), _index(0), _active(active), |
34 _qset(qset), _buf(NULL), _index(0), _sz(0), _active(active), |
35 _perm(perm), _lock(NULL) |
35 _perm(perm), _lock(NULL) |
36 {} |
36 {} |
37 |
37 |
38 void PtrQueue::flush() { |
38 PtrQueue::~PtrQueue() { |
|
39 assert(_perm || (_buf == NULL), "queue must be flushed before delete"); |
|
40 } |
|
41 |
|
42 void PtrQueue::flush_impl() { |
39 if (!_perm && _buf != NULL) { |
43 if (!_perm && _buf != NULL) { |
40 if (_index == _sz) { |
44 if (_index == _sz) { |
41 // No work to do. |
45 // No work to do. |
42 qset()->deallocate_buffer(_buf); |
46 qset()->deallocate_buffer(_buf); |
43 } else { |
47 } else { |