Class: Concurrent::Promises::ResolvableEvent
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
|
|
|
Instance Chain:
|
|
| Inherits: |
Concurrent::Promises::Event
|
| Defined in: | lib/concurrent-ruby/concurrent/promises.rb |
Overview
A Event which can be resolved by user.
Constant Summary
InternalStates - Included
Class Attribute Summary
Synchronization::Object - Inherited
Class Method Summary
AbstractEventFuture - Inherited
Synchronization::Object - Inherited
| .atomic_attribute?, .atomic_attributes, | |
| .attr_atomic | Creates methods for reading and writing to a instance variable with volatile (Java) semantic as |
| .attr_volatile | Creates methods for reading and writing (as |
| .ensure_safe_initialization_when_final_fields_are_present | For testing purposes, quite slow. |
| .new | Has to be called by children. |
| .safe_initialization!, .define_initialize_atomic_fields | |
Synchronization::AbstractObject - Inherited
Instance Attribute Summary
AbstractEventFuture - Inherited
| #pending? | Is it in pending state? |
| #resolved? | Is it in resolved state? |
| #touched? | For inspection. |
Instance Method Summary
-
#resolve(raise_on_reassign = true, reserved = false) ⇒ self, false
Makes the event resolved, which triggers all dependent futures.
-
#wait(timeout = nil, resolve_on_timeout = false) ⇒ self, ...
Behaves as AbstractEventFuture#wait but has one additional optional argument resolve_on_timeout.
-
#with_hidden_resolvable ⇒ Event
Creates new event wrapping receiver, effectively hiding the resolve method.
Resolvable - Included
| #release, | |
| #reserve | Reserves the event or future, if reserved others are prevented from resolving it. |
Event - Inherited
| #& | Alias for Event#zip. |
| #any | Creates a new event which will be resolved when the first of receiver, |
| #delay | Creates new event dependent on receiver which will not evaluate until touched, see |
| #schedule | Creates new event dependent on receiver scheduled to execute on/in intended_time. |
| #then | Alias for AbstractEventFuture#chain. |
| #to_event | Returns self, since this is event. |
| #to_future | Converts event to a future. |
| #with_default_executor | Crates new object with same class with the executor set as its new default executor. |
| #zip | Creates a new event or a future which will be resolved when receiver and other are. |
| #| | Alias for Event#any. |
| #callback_on_resolution, #rejected_resolution | |
AbstractEventFuture - Inherited
| #chain | Shortcut of |
| #chain_on | Chains the task to be executed asynchronously on executor after it is resolved. |
| #chain_resolvable | Resolves the resolvable when receiver is resolved. |
| #default_executor | Returns default executor. |
| #inspect | Alias for AbstractEventFuture#to_s. |
| #internal_state, | |
| #on_resolution | Shortcut of |
| #on_resolution! | Stores the callback to be executed synchronously on resolving thread after it is resolved. |
| #on_resolution_using | Stores the callback to be executed asynchronously on executor after it is resolved. |
| #state | Returns its state. |
| #tangle | Alias for AbstractEventFuture#chain_resolvable. |
| #to_s, | |
| #touch | Propagates touch. |
| #wait | Wait (block the Thread) until receiver is |
| #with_default_executor | Crates new object with same class with the executor set as its new default executor. |
| #add_callback, #add_callback_clear_delayed_node, #add_callback_notify_blocked, #async_callback_on_resolution, | |
| #blocks | For inspection. |
| #call_callback, #call_callbacks, #callback_clear_delayed_node, #callback_notify_blocked, | |
| #callbacks | For inspection. |
| #compare_and_set_internal_state | Sets the internal_state to new_internal_state if the current internal_state is expected_internal_state. |
| #internal_state= |
|
| #promise | For inspection. |
| #resolve_with, | |
| #swap_internal_state |
|
| #update_internal_state | Updates the internal_state using the block. |
| #wait_until_resolved, | |
| #waiting_threads | For inspection. |
| #with_async, #with_hidden_resolvable | |
Synchronization::Object - Inherited
Synchronization::Volatile - Included
Synchronization::AbstractObject - Inherited
Constructor Details
This class inherits a constructor from Concurrent::Promises::AbstractEventFuture
Instance Method Details
#resolve(raise_on_reassign = true, reserved = false) ⇒ self, false
Makes the event resolved, which triggers all dependent futures.
# File 'lib/concurrent-ruby/concurrent/promises.rb', line 1324
def resolve(raise_on_reassign = true, reserved = false) resolve_with RESOLVED, raise_on_reassign, reserved end
#wait(timeout = nil, resolve_on_timeout = false) ⇒ self, ...
Behaves as AbstractEventFuture#wait but has one additional optional argument resolve_on_timeout.
# File 'lib/concurrent-ruby/concurrent/promises.rb', line 1342
def wait(timeout = nil, resolve_on_timeout = false) super(timeout) or if resolve_on_timeout # if it fails to resolve it was resolved in the meantime # so return true as if there was no timeout !resolve(false) else false end end