Module: ZeevexConcurrency::Delayed::Cancellable

Included in:
Future
Defined in:
lib/zeevex_concurrency/delayed.rb

Instance Method Summary collapse

Instance Method Details

#cancelObject



213
214
215
216
217
218
219
220
221
# File 'lib/zeevex_concurrency/delayed.rb', line 213

def cancel
  @exec_mutex.synchronize do
    return false if executed?
    return true  if cancelled?
    @cancelled = true
    _smash CancelledException.new
    true
  end
end

#cancelled?Boolean

Returns:

  • (Boolean)


209
210
211
# File 'lib/zeevex_concurrency/delayed.rb', line 209

def cancelled?
  @cancelled
end

#ready?Boolean

Returns:

  • (Boolean)


223
224
225
# File 'lib/zeevex_concurrency/delayed.rb', line 223

def ready?
  cancelled? || super
end