Class: Concurrent::Promises::ResolvableEvent

Inherits:
Event show all
Includes:
Resolvable
Defined in:
lib/concurrent/promises.rb

Overview

A Event which can be resolved by user.

Instance Method Summary collapse

Methods inherited from Event

#any, #delay, #schedule, #to_event, #to_future, #with_default_executor, #zip

Methods inherited from AbstractEventFuture

#chain, #chain_on, #chain_resolvable, #default_executor, #on_resolution, #on_resolution!, #on_resolution_using, #pending?, #resolved?, #state, #to_s, #touch, #wait, #with_default_executor

Methods inherited from Synchronization::Object

attr_atomic, attr_volatile, ensure_safe_initialization_when_final_fields_are_present, #initialize, new, safe_initialization!, safe_initialization?, volatile_cas_fields

Instance Method Details

#resolve(raise_on_reassign = true) ⇒ self, false

Makes the event resolved, which triggers all dependent futures.

Parameters:

  • raise_on_reassign (Boolean) (defaults to: true)

    should method raise exception if already resolved

Returns:

  • (self, false)

    false is returner when raise_on_reassign is false and the receiver is already resolved.



1230
1231
1232
# File 'lib/concurrent/promises.rb', line 1230

def resolve(raise_on_reassign = true)
  resolve_with RESOLVED, raise_on_reassign
end

#with_hidden_resolvableEvent

Creates new event wrapping receiver, effectively hiding the resolve method.

Returns:



1237
1238
1239
# File 'lib/concurrent/promises.rb', line 1237

def with_hidden_resolvable
  @with_hidden_resolvable ||= EventWrapperPromise.new_blocked_by1(self, @DefaultExecutor).event
end