Class: OS::Mac::FFI::CoreFoundation::ReleasePool Private
- Defined in:
- os/mac/ffi/core_foundation.rb
Overview
This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.
Tracks Core Foundation objects so they can be released deterministically.
Instance Method Summary collapse
- #drain ⇒ void private
- #initialize ⇒ void constructor private
-
#track(ptr) ⇒ Fiddle::Pointer
private
Registers an owned Core Foundation object for release when the pool is drained and returns it unchanged.
Constructor Details
#initialize ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
27 28 29 |
# File 'os/mac/ffi/core_foundation.rb', line 27 def initialize @pointers = T.let([], T::Array[Fiddle::Pointer]) end |
Instance Method Details
#drain ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
40 41 42 43 |
# File 'os/mac/ffi/core_foundation.rb', line 40 def drain @pointers.reverse_each { |ptr| CoreFoundation.release(ptr) } @pointers.clear end |
#track(ptr) ⇒ Fiddle::Pointer
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Registers an owned Core Foundation object for release when the pool is drained and returns it unchanged.
34 35 36 37 |
# File 'os/mac/ffi/core_foundation.rb', line 34 def track(ptr) @pointers << ptr unless ptr.null? ptr end |