Class: Concurrent::Edge::Channel

Inherits:
Synchronization::Object show all
Defined in:
lib/concurrent/edge/future.rb

Overview

Note:

proof of concept

Instance Method Summary (collapse)

Constructor Details

- (Channel) initialize

TODO make lock free



1378
1379
1380
1381
1382
# File 'lib/concurrent/edge/future.rb', line 1378

def initialize
  super
  @ProbeSet = Concurrent::Channel::WaitableList.new
  ensure_ivar_visibility!
end

Instance Method Details

- (Object) inspect



1402
1403
1404
# File 'lib/concurrent/edge/future.rb', line 1402

def inspect
  to_s
end

- (Object) pop



1393
1394
1395
# File 'lib/concurrent/edge/future.rb', line 1393

def pop
  select(Concurrent.future)
end

- (Object) probe_set_size



1384
1385
1386
# File 'lib/concurrent/edge/future.rb', line 1384

def probe_set_size
  @ProbeSet.size
end

- (Object) push(value)



1388
1389
1390
1391
# File 'lib/concurrent/edge/future.rb', line 1388

def push(value)
  until @ProbeSet.take.try_success([value, self])
  end
end

- (Object) select(probe)



1397
1398
1399
1400
# File 'lib/concurrent/edge/future.rb', line 1397

def select(probe)
  @ProbeSet.put(probe)
  probe
end