Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.jruby.ext.ffi.jffi;
 import org.jruby.Ruby;
An implementation of MemoryIO that throws exceptions on any attempt to read/write the callback memory area (which is code). This also keeps the callback alive via the handle member, as long as this CallbackMemoryIO instance is contained in a valid Callback pointer.
final class CallbackMemoryIO extends InvalidMemoryIO implements AllocatedDirectMemoryIO {
    private final Closure.Handle handle;
    private volatile boolean released;
    private volatile boolean unmanaged;
    private Object proc;
    public CallbackMemoryIO(Ruby runtimeClosure.Handle handleObject proc) {
        this. = handle;
        this. = proc;
    public CallbackMemoryIO(Ruby runtimeClosure.Handle handle) {
    public final long getAddress() {
        return .getAddress();
    public final boolean isNull() {
        return false;
    public final boolean isDirect() {
        return true;
    public synchronized void free() {
        if (!) {
            this. = null;
             = true;
             = true;
    public synchronized void setAutoRelease(boolean autorelease) {
        if (isAutoRelease() != autorelease) {
             = !autorelease;
    public boolean isAutoRelease() {
        return !;
New to GrepCode? Check out our FAQ X