public NativeCallbackFactory(Ruby runtime, CallbackInfo cbInfo) { this.runtime = runtime; this.closureInfo = newFunctionInfo(runtime, cbInfo); this.closurePool = com.kenai.jffi.ClosureManager.getInstance().getClosurePool(closureInfo.callContext); this.callbackInfo = cbInfo; this.callbackClass = runtime.getModule("FFI").getClass("Callback"); }
/** */ final CallbackMemoryIO newClosure(Ruby runtime, Type returnType, Type[] parameterTypes, Object proc, CallingConvention convention) { NativeFunctionInfo info = new NativeFunctionInfo(runtime, returnType, parameterTypes, convention); final NativeClosureProxy cbProxy = new NativeClosureProxy(runtime, info, proc); final Closure.Handle handle = ClosureManager.getInstance().newClosure(cbProxy, info.callContext); return new CallbackMemoryIO(runtime, handle, proc); }
NativeClosurePointer allocateClosurePointer() { NativeClosurePointer closurePointer = freeQueue.poll(); if (closurePointer != null) { return closurePointer; } NativeClosureProxy proxy = closureProxyFactory.newClosureProxy(); Closure.Handle closureHandle = null; synchronized (this) { do { if (currentMagazine == null || ((closureHandle = currentMagazine.allocate(proxy)) == null)) { currentMagazine = ClosureManager.getInstance().newClosureMagazine(callContext, closureProxyFactory.getInvokeMethod()); } } while (closureHandle == null); } return new NativeClosurePointer(runtime, closureHandle, proxy); }
/** * Wraps a java object that implements the {@link Closure} interface in a * native closure. * * @param closure The java object to be called when the native closure is invoked. * @param callContext The call context (return type, param types, convention) of the Closure * @return A new {@link Closure.Handle} instance. */ public final Closure.Handle newClosure(Closure closure, CallContext callContext) { ClosurePool pool = getClosurePool(callContext); return pool.newClosureHandle(closure); }
/** * Wraps a java object that implements the {@link Closure} interface in a * native closure. * * @param closure The java object to be called when the native closure is invoked. * @param returnType The return type of the closure. * @param parameterTypes The parameter types of the closure. * @param convention The calling convention of the closure. * @return A new {@link Closure.Handle} instance. */ public final Closure.Handle newClosure(Closure closure, Type returnType, Type[] parameterTypes, CallingConvention convention) { return newClosure(closure, CallContextCache.getInstance().getCallContext(returnType, parameterTypes, convention)); }
NativeClosurePointer allocateClosurePointer() { NativeClosurePointer closurePointer = freeQueue.poll(); if (closurePointer != null) { return closurePointer; } NativeClosureProxy proxy = closureProxyFactory.newClosureProxy(); Closure.Handle closureHandle = null; synchronized (this) { do { if (currentMagazine == null || ((closureHandle = currentMagazine.allocate(proxy)) == null)) { currentMagazine = ClosureManager.getInstance().newClosureMagazine(callContext, closureProxyFactory.getInvokeMethod()); } } while (closureHandle == null); } return new NativeClosurePointer(runtime, closureHandle, proxy); }
/** * Wraps a java object that implements the {@link Closure} interface in a * native closure. * * @param closure The java object to be called when the native closure is invoked. * @param callContext The call context (return type, param types, convention) of the Closure * @return A new {@link Closure.Handle} instance. */ public final Closure.Handle newClosure(Closure closure, CallContext callContext) { ClosurePool pool = getClosurePool(callContext); return pool.newClosureHandle(closure); }
/** * Wraps a java object that implements the {@link Closure} interface in a * native closure. * * @param closure The java object to be called when the native closure is invoked. * @param returnType The return type of the closure. * @param parameterTypes The parameter types of the closure. * @param convention The calling convention of the closure. * @return A new {@link Closure.Handle} instance. */ public final Closure.Handle newClosure(Closure closure, Type returnType, Type[] parameterTypes, CallingConvention convention) { return newClosure(closure, CallContextCache.getInstance().getCallContext(returnType, parameterTypes, convention)); }
public NativeCallbackFactory(Ruby runtime, CallbackInfo cbInfo) { this.runtime = runtime; this.closureInfo = newFunctionInfo(runtime, cbInfo); this.closurePool = com.kenai.jffi.ClosureManager.getInstance().getClosurePool(closureInfo.callContext); this.callbackInfo = cbInfo; this.callbackClass = runtime.getModule("FFI").getClass("Callback"); }
/** */ final CallbackMemoryIO newClosure(Ruby runtime, Type returnType, Type[] parameterTypes, Object proc, CallingConvention convention) { NativeFunctionInfo info = new NativeFunctionInfo(runtime, returnType, parameterTypes, convention); final NativeClosureProxy cbProxy = new NativeClosureProxy(runtime, info, proc); final Closure.Handle handle = ClosureManager.getInstance().newClosure(cbProxy, info.callContext); return new CallbackMemoryIO(runtime, handle, proc); }
NativeClosurePointer allocateClosurePointer() { NativeClosurePointer closurePointer = freeQueue.poll(); if (closurePointer != null) { return closurePointer; } NativeClosureProxy proxy = closureProxyFactory.newClosureProxy(); Closure.Handle closureHandle = null; synchronized (this) { do { if (currentMagazine == null || ((closureHandle = currentMagazine.allocate(proxy)) == null)) { currentMagazine = ClosureManager.getInstance().newClosureMagazine(callContext, closureProxyFactory.getInvokeMethod()); } } while (closureHandle == null); } return new NativeClosurePointer(runtime, closureHandle, proxy); }
/** * Wraps a java object that implements the {@link Closure} interface in a * native closure. * * @param closure The java object to be called when the native closure is invoked. * @param callContext The call context (return type, param types, convention) of the Closure * @return A new {@link Closure.Handle} instance. */ public final Closure.Handle newClosure(Closure closure, CallContext callContext) { ClosurePool pool = getClosurePool(callContext); return pool.newClosureHandle(closure); }
/** * Wraps a java object that implements the {@link Closure} interface in a * native closure. * * @param closure The java object to be called when the native closure is invoked. * @param returnType The return type of the closure. * @param parameterTypes The parameter types of the closure. * @param convention The calling convention of the closure. * @return A new {@link Closure.Handle} instance. */ public final Closure.Handle newClosure(Closure closure, Type returnType, Type[] parameterTypes, CallingConvention convention) { return newClosure(closure, CallContextCache.getInstance().getCallContext(returnType, parameterTypes, convention)); }
public NativeCallbackFactory(Ruby runtime, CallbackInfo cbInfo) { this.runtime = runtime; this.closureInfo = newFunctionInfo(runtime, cbInfo); this.closurePool = com.kenai.jffi.ClosureManager.getInstance().getClosurePool(closureInfo.callContext); this.callbackInfo = cbInfo; this.callbackClass = runtime.getModule("FFI").getClass("Callback"); }
/** */ final CallbackMemoryIO newClosure(Ruby runtime, Type returnType, Type[] parameterTypes, Object proc, CallingConvention convention) { NativeFunctionInfo info = new NativeFunctionInfo(runtime, returnType, parameterTypes, convention); final NativeClosureProxy cbProxy = new NativeClosureProxy(runtime, info, proc); final Closure.Handle handle = ClosureManager.getInstance().newClosure(cbProxy, info.callContext); return new CallbackMemoryIO(runtime, handle, proc); }
public NativeCallbackFactory(Ruby runtime, CallbackInfo cbInfo) { this.runtime = runtime; this.closureInfo = newFunctionInfo(runtime, cbInfo); this.closurePool = com.kenai.jffi.ClosureManager.getInstance().getClosurePool(closureInfo.callContext); this.callbackInfo = cbInfo; this.callbackClass = runtime.getModule("FFI").getClass("Callback"); }
/** */ final CallbackMemoryIO newClosure(Ruby runtime, Type returnType, Type[] parameterTypes, Object proc, CallingConvention convention) { NativeFunctionInfo info = new NativeFunctionInfo(runtime, returnType, parameterTypes, convention); final NativeClosureProxy cbProxy = new NativeClosureProxy(runtime, info, proc); final Closure.Handle handle = ClosureManager.getInstance().newClosure(cbProxy, info.callContext); return new CallbackMemoryIO(runtime, handle, proc); }