lib/czmq-ffi-gen/czmq/ffi/zactor.rb in czmq-ffi-gen-0.2.0 vs lib/czmq-ffi-gen/czmq/ffi/zactor.rb in czmq-ffi-gen-0.2.1
- old
+ new
@@ -58,13 +58,20 @@
# pointing to the native object
def __ptr_give_ref
raise DestroyedError unless @ptr
ptr_ptr = ::FFI::MemoryPointer.new :pointer
ptr_ptr.write_pointer @ptr
- ObjectSpace.undefine_finalizer self if @finalizer
- @finalizer = nil
+ __undef_finalizer if @finalizer
@ptr = nil
ptr_ptr
+ end
+ # Undefines the finalizer for this object.
+ # @note Only use this if you need to and can guarantee that the native
+ # object will be freed by other means.
+ # @return [void]
+ def __undef_finalizer
+ ObjectSpace.undefine_finalizer self
+ @finalizer = nil
end
# Create a new callback of the following type:
# Actors get a pipe and arguments from caller
# typedef void (zactor_fn) (