[jmm-dev] VarHandle.safepoint() methods
Andrew Haley
aph at redhat.com
Thu Jan 5 09:37:58 UTC 2017
On 04/01/17 20:11, Sanjoy Das wrote:
> Have you considered something like this:
>
> public void unmap() {
> MappedByteBuffer buf = buf();
> vh.setOpaque(null);
> while (true) {
> Traces = Thread.getAllStackTraces();
> // If no trace in Traces contains a get() method or something
> // equivalent then break; else loop.
> }
> unmap(buf);
> }
>
> and nothing special about the get() methods.
>
> I'm not sure how well Thread.getAllStackTraces() works in practice
> though.
That's an interesting idea, but it's extremely heavyweight and
would require precise tracing of all threads, and I think you'd need
a safepoint to do that.
Andrew.
More information about the jmm-dev
mailing list