< prev index next >
src/share/vm/jfr/recorder/storage/jfrStorageUtils.inline.hpp
Print this page
rev 9053 : 8220293: Deadlock in JFR string pool
Reviewed-by: rehn, egahlin
*** 24,33 ****
--- 24,34 ----
#ifndef SHARE_VM_JFR_RECORDER_STORAGE_JFRSTORAGEUTILS_INLINE_HPP
#define SHARE_VM_JFR_RECORDER_STORAGE_JFRSTORAGEUTILS_INLINE_HPP
#include "jfr/recorder/storage/jfrStorageUtils.hpp"
+ #include "runtime/thread.inline.hpp"
template <typename T>
inline bool UnBufferedWriteToChunk<T>::write(T* t, const u1* data, size_t size) {
_writer.write_unbuffered(data, size);
_processed += size;
*** 73,82 ****
--- 74,105 ----
const bool result = _operation.write(t, current_top, unflushed_size);
t->set_top(current_top + unflushed_size);
return result;
}
+ template <typename Type>
+ static void retired_sensitive_acquire(Type* t) {
+ assert(t != NULL, "invariant");
+ if (t->retired()) {
+ return;
+ }
+ Thread* const thread = Thread::current();
+ while (!t->try_acquire(thread)) {
+ if (t->retired()) {
+ return;
+ }
+ }
+ }
+
+ template <typename Operation>
+ inline bool ExclusiveOp<Operation>::process(typename Operation::Type* t) {
+ retired_sensitive_acquire(t);
+ assert(t->acquired_by_self() || t->retired(), "invariant");
+ // User is required to ensure proper release of the acquisition
+ return MutexedWriteOp<Operation>::process(t);
+ }
+
template <typename Operation>
inline bool DiscardOp<Operation>::process(typename Operation::Type* t) {
assert(t != NULL, "invariant");
const u1* const current_top = _mode == concurrent ? t->concurrent_top() : t->top();
const size_t unflushed_size = t->pos() - current_top;
< prev index next >