Method: FFI.dec_ref
- Defined in:
- lib/ffi-value.rb
.dec_ref(object) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/ffi-value.rb', line 48 def self.dec_ref(object) refcount = nil ValueStoreMutex.synchronize { _, refcount = ValueStore[object.object_id] refcount -= 1 if (refcount <= 0) then ValueStore.delete(object.object_id) else ValueStore[object.object_id] = [object, refcount] end } if refcount < 0 raise ArgumentError.new("Object: #{object.object_id} was not previously referenced!") end refcount end |