Class: Concurrent::Channel::Probe
- Inherits:
-
IVar
- Object
- IVar
- Concurrent::Channel::Probe
show all
- Defined in:
- lib/concurrent/channel/channel.rb
Instance Method Summary
collapse
Methods inherited from IVar
#add_observer, #fail, #set
Methods included from Observable
#add_observer, #count_observers, #delete_observer, #delete_observers, #with_observer
Methods included from Obligation
#completed?, #exception, #fulfilled?, #incomplete?, #no_error!, #pending?, #reason, #rejected?, #state, #unscheduled?, #value!, #wait
Constructor Details
#initialize(value = NO_VALUE, opts = {}) ⇒ Probe
Returns a new instance of Probe.
8
9
10
|
# File 'lib/concurrent/channel/channel.rb', line 8
def initialize(value = NO_VALUE, opts = {})
super(value, opts)
end
|
Instance Method Details
#channel ⇒ Object
28
29
30
|
# File 'lib/concurrent/channel/channel.rb', line 28
def channel
composite_value.nil? ? nil : composite_value[1]
end
|
#composite_value ⇒ Object
22
|
# File 'lib/concurrent/channel/channel.rb', line 22
alias_method :composite_value, :value
|
#set_unless_assigned(value, channel) ⇒ Object
12
13
14
15
16
17
18
19
20
|
# File 'lib/concurrent/channel/channel.rb', line 12
def set_unless_assigned(value, channel)
mutex.synchronize do
return false if [:fulfilled, :rejected].include? @state
set_state(true, [value, channel], nil)
event.set
true
end
end
|
#value ⇒ Object
24
25
26
|
# File 'lib/concurrent/channel/channel.rb', line 24
def value
composite_value.nil? ? nil : composite_value[0]
end
|