class Riffer::Rig::Runtime::Concurrency
Public Class Methods
() → void
Source
# File lib/riffer/rig/runtime/concurrency.rb, line 10 def initialize @busy = false @closed = false @depth = 0 @thread = nil end
@rbs return: void
Public Instance Methods
() → bool
Source
# File lib/riffer/rig/runtime/concurrency.rb, line 49 def busy? @busy end
@rbs return: bool
() → void
Source
# File lib/riffer/rig/runtime/concurrency.rb, line 18 def claim raise Riffer::Rig::Runtime::BusyError, 'a prompt is already running on this Runtime' if @busy raise Riffer::Rig::Runtime::ClosedError, 'this Runtime is closed' if @closed hold end
@rbs return: void
() → void
Source
# File lib/riffer/rig/runtime/concurrency.rb, line 30 def claim_rebuild if @busy && @thread != Thread.current raise Riffer::Rig::Runtime::BusyError, 'a prompt is already running on this Runtime' end raise Riffer::Rig::Runtime::ClosedError, 'this Runtime is closed' if @closed hold end
Rebuild is a configuration swap at a quiet boundary, not a turn entry, so it may run nested under the thread that holds the Runtime — the /reload command and the automatic reload check both do. Another thread is still refused while work runs. @rbs return: void
() → void
Source
# File lib/riffer/rig/runtime/concurrency.rb, line 54 def close @closed = true end
@rbs return: void
() → bool
Source
# File lib/riffer/rig/runtime/concurrency.rb, line 59 def closed? @closed end
@rbs return: bool
() → void
Source
# File lib/riffer/rig/runtime/concurrency.rb, line 40 def release @depth -= 1 return if @depth.positive? @busy = false @thread = nil end
@rbs return: void