method
set_callback_internal
ruby latest stable - Class:
DL
Method deprecated or moved
This method is deprecated or moved on the latest stable version. The last existing version (v2_1_10) is shown here.
set_callback_internal(proc_entry, addr_entry, argc, ty, abi = nil, &cbp)public
No documentation available.
# File ext/dl/lib/dl/callback.rb, line 30
def set_callback_internal(proc_entry, addr_entry, argc, ty, abi = nil, &cbp)
if( argc < 0 )
raise(ArgumentError, "arity should not be less than 0.")
end
addr = nil
if DL.fiddle?
abi ||= Fiddle::Function::DEFAULT
closure = Fiddle::Closure::BlockCaller.new(ty, [TYPE_VOIDP] * argc, abi, &cbp)
proc_entry[closure.to_i] = closure
addr = closure.to_i
else
SEM.synchronize{
ary = proc_entry[ty]
(0...MAX_CALLBACK).each{|n|
idx = (n * DLSTACK_SIZE) + argc
if( ary[idx].nil? )
ary[idx] = cbp
addr = addr_entry[ty][idx]
break
end
}
}
end
addr
end