Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions spec/ffi/callback_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -856,8 +856,8 @@ module CallbackInteropSpecs
module LibTestFFI
extend FFI::Library
ffi_lib TestLibrary::PATH
attach_function :testCallbackVrV, :testClosureVrV, [ :pointer ], :void
attach_function :testCallbackVrV_blocking, :testClosureVrV, [ :pointer ], :void, blocking: true
@cb = attach_function :testCallbackVrV, :testClosureVrV, [ :pointer ], :void
@cb_blocking = attach_function :testCallbackVrV_blocking, :testClosureVrV, [ :pointer ], :void, blocking: true
end

module LibTestFiddle
Expand All @@ -866,6 +866,13 @@ module LibTestFiddle
extern 'void testClosureVrV(void *fp)'
end

after do
LibTestFFI.instance_variable_set(:@cb, nil)
LibTestFFI.instance_variable_set(:@cb_blocking, nil)
GC.start
expect(ObjectSpace.each_object(Fiddle::Closure) {}).to eq(0)
end

def assert_callback_in_same_thread_called_once
called = 0
thread = nil
Expand Down