Class: XfOOrth::XfOOrth_SyncBundle

Inherits:
XfOOrth_Bundle show all
Defined in:
lib/fOOrth/library/sync_bundle_library.rb

Overview

The fOOrth Synchronized Bundle class. A bundle contains multiple fibers.

Instance Method Summary collapse

Methods inherited from XfOOrth_Bundle

#run, #to_foorth_fiber

Constructor Details

#initialize(fibers = []) ⇒ XfOOrth_SyncBundle

Build up the synchronized bundle instance



13
14
15
16
# File 'lib/fOOrth/library/sync_bundle_library.rb', line 13

def initialize(fibers=[])
  @sync = Mutex.new
  super(fibers)
end

Instance Method Details

#add_fibers(fibers) ⇒ Object

Add the fibers to this bundle.



19
20
21
# File 'lib/fOOrth/library/sync_bundle_library.rb', line 19

def add_fibers(fibers)
  @sync.synchronize{super(fibers)}
end

#lengthObject

how many fibers in this bundle?



29
30
31
# File 'lib/fOOrth/library/sync_bundle_library.rb', line 29

def length
  @sync.synchronize{super}
end

#statusObject

What is the status of this bundle?



24
25
26
# File 'lib/fOOrth/library/sync_bundle_library.rb', line 24

def status
  @sync.synchronize{super}
end

#step(vm) ⇒ Object

Let the fiber run for one step



34
35
36
# File 'lib/fOOrth/library/sync_bundle_library.rb', line 34

def step(vm)
  @sync.synchronize{super(vm)}
end