Class: Ibex::Runtime::CancellationToken
- Inherits:
-
Object
- Object
- Ibex::Runtime::CancellationToken
- Defined in:
- lib/json5/generated_parser.rb
Overview
Thread-safe cooperative cancellation state for one or more operations.
Instance Method Summary collapse
-
#cancel! ⇒ Object
rubocop:disable Naming/PredicateMethod -- command mutation convention.
- #cancelled? ⇒ Boolean
-
#initialize ⇒ CancellationToken
constructor
A new instance of CancellationToken.
Constructor Details
#initialize ⇒ CancellationToken
Returns a new instance of CancellationToken.
3969 3970 3971 3972 |
# File 'lib/json5/generated_parser.rb', line 3969 def initialize @mutex = Mutex.new #: Mutex @cancelled = false #: bool end |
Instance Method Details
#cancel! ⇒ Object
rubocop:disable Naming/PredicateMethod -- command mutation convention.
3976 3977 3978 3979 |
# File 'lib/json5/generated_parser.rb', line 3976 def cancel! @mutex.synchronize { @cancelled = true } true end |
#cancelled? ⇒ Boolean
3983 3984 3985 |
# File 'lib/json5/generated_parser.rb', line 3983 def cancelled? @mutex.synchronize { @cancelled } end |