Class: Concurrent::Edge::Channel

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

Overview

Note:

proof of concept

Instance Method Summary collapse

Constructor Details

#initializeChannel

TODO make lock free



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

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

Instance Method Details

#inspectObject



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

def inspect
  to_s
end

#popObject



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

def pop
  select(Concurrent.future)
end

#probe_set_sizeObject



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

def probe_set_size
  @ProbeSet.size
end

#push(value) ⇒ Object



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

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

#select(probe) ⇒ Object



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

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