Class: Proj::LifeSpan
- Inherits:
-
Object
- Object
- Proj::LifeSpan
- Defined in:
- lib/proj/life_span.rb
Overview
Tracks whether a PROJ context is still alive. Shared between a Context and the finalizers of objects that depend on it (PjObject, Session). Because Ruby’s GC finalizer ordering is non-deterministic during shutdown, a dependent’s finalizer may run after its context has already been destroyed. Calling proj_destroy() in that situation segfaults (PROJ 9.8+). This object lets dependents check before calling into PROJ.
Instance Method Summary collapse
- #alive? ⇒ Boolean
- #ended! ⇒ Object
-
#initialize ⇒ LifeSpan
constructor
A new instance of LifeSpan.
Constructor Details
#initialize ⇒ LifeSpan
Returns a new instance of LifeSpan.
9 10 11 |
# File 'lib/proj/life_span.rb', line 9 def initialize @alive = true end |
Instance Method Details
#alive? ⇒ Boolean
13 14 15 |
# File 'lib/proj/life_span.rb', line 13 def alive? @alive end |
#ended! ⇒ Object
17 18 19 |
# File 'lib/proj/life_span.rb', line 17 def ended! @alive = false end |