Class: Fairy::PLocalFind
- Inherits:
-
PSingleExportFilter
- Object
- PFilter
- PIOFilter
- PSingleExportFilter
- Fairy::PLocalFind
- Defined in:
- lib/fairy/node/p-find.rb
Constant Summary
Constants included from PSingleExportable
Fairy::PSingleExportable::END_OF_STREAM, Fairy::PSingleExportable::ST_EXPORT_FINISH, Fairy::PSingleExportable::ST_WAIT_EXPORT_FINISH
Constants inherited from PIOFilter
Fairy::PIOFilter::ST_WAIT_IMPORT
Constants inherited from PFilter
Fairy::PFilter::END_OF_STREAM, Fairy::PFilter::ST_ACTIVATE, Fairy::PFilter::ST_FINISH, Fairy::PFilter::ST_INIT
Instance Attribute Summary
Attributes included from PSingleExportable
Attributes inherited from PFilter
#IGNORE_EXCEPTION, #id, #log_id, #ntask
Instance Method Summary collapse
- #basic_each(&block) ⇒ Object
-
#find_break ⇒ Object
def start super do @import.each do |e| # 見つかっていたら空読み @find_mutex.synchronize do next if @find next unless find = @map_proc.yield(e) @export.push e end end end end.
-
#initialize(id, ntask, bjob, opts, block_source) ⇒ PLocalFind
constructor
A new instance of PLocalFind.
Methods included from PSingleExportable
#start, #start_export, #terminate, #wait_export_finish
Methods inherited from PIOFilter
Methods inherited from PFilter
#abort_running, #basic_start, #break_running, #each, #global_break, #global_break_from_other, #handle_exception, #key, #key=, #next, #no, #no=, #notice_status, #processor, #start, #start_export, #start_watch_status, #status=, #terminate, #terminate_proc
Constructor Details
#initialize(id, ntask, bjob, opts, block_source) ⇒ PLocalFind
Returns a new instance of PLocalFind.
14 15 16 17 18 19 20 |
# File 'lib/fairy/node/p-find.rb', line 14 def initialize(id, ntask, bjob, opts, block_source) super @block_source = block_source @findp = false @findp_mutex = Mutex.new end |
Instance Method Details
#basic_each(&block) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/fairy/node/p-find.rb', line 22 def basic_each(&block) @find_proc = BBlock.new(@block_source, @context, self) @input.each do |e| # 見つかっていたら空読み @findp_mutex.synchronize do next if @findp if !(@findp = @find_proc.yield(e)) next elsif Import::CTLTOKEN_NULLVALUE === @findp @findp = false next end block.call e end end end |
#find_break ⇒ Object
def start
super do
@import.each do |e| # 見つかっていたら空読み @find_mutex.synchronize do next if @find next unless find = @map_proc.yield(e) @export.push e end end
end
end
53 54 55 56 57 |
# File 'lib/fairy/node/p-find.rb', line 53 def find_break @find_mutex.synchronize do @findp = true end end |