Class: Crimson::AbortSignal
- Inherits:
-
Object
- Object
- Crimson::AbortSignal
- Defined in:
- lib/crimson/agent.rb
Overview
Thread-safe abort signal for cancelling tool execution mid-flight.
Instance Method Summary collapse
-
#abort! ⇒ void
Mark as aborted.
-
#aborted? ⇒ Boolean
Whether abort has been requested.
-
#initialize ⇒ AbortSignal
constructor
A new instance of AbortSignal.
-
#reset ⇒ void
Reset abort state.
Constructor Details
#initialize ⇒ AbortSignal
Returns a new instance of AbortSignal.
9 10 11 12 |
# File 'lib/crimson/agent.rb', line 9 def initialize @aborted = false @mutex = Mutex.new end |
Instance Method Details
#abort! ⇒ void
This method returns an undefined value.
Mark as aborted.
16 17 18 |
# File 'lib/crimson/agent.rb', line 16 def abort! @mutex.synchronize { @aborted = true } end |
#aborted? ⇒ Boolean
Returns whether abort has been requested.
21 22 23 |
# File 'lib/crimson/agent.rb', line 21 def aborted? @mutex.synchronize { @aborted } end |
#reset ⇒ void
This method returns an undefined value.
Reset abort state.
27 28 29 |
# File 'lib/crimson/agent.rb', line 27 def reset @mutex.synchronize { @aborted = false } end |