Class: JRL::Fiber

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/jretlang/fiber.rb

Instance Method Summary collapse

Constructor Details

#initializeFiber

Returns a new instance of Fiber.



2
3
4
5
# File 'lib/jretlang/fiber.rb', line 2

def initialize
  @f = JRL::Fibers::ThreadFiber.new 
  super( @f )
end

Instance Method Details

#schedule_one_time(delay, time_unit = JRL::Concurrent::TimeUnit::SECONDS, &block) ⇒ Object



7
8
9
# File 'lib/jretlang/fiber.rb', line 7

def schedule_one_time( delay, time_unit=JRL::Concurrent::TimeUnit::SECONDS, &block )
  @f.schedule( block, delay, time_unit )
end

#schedule_repeating(delay, interval, time_unit = JRL::Concurrent::TimeUnit::SECONDS, &block) ⇒ Object



11
12
13
# File 'lib/jretlang/fiber.rb', line 11

def schedule_repeating( delay, interval, time_unit=JRL::Concurrent::TimeUnit::SECONDS, &block )
  @f.schedule_with_fixed_delay( block, delay, interval, time_unit )
end