Method: Fairy::CFilter#each_node
- Defined in:
- lib/fairy/master/c-filter.rb
#each_node(flag = nil, &block) ⇒ Object
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/fairy/master/c-filter.rb', line 124 def each_node(flag = nil, &block) if flag == :exist_only return each_node_exist_only &block end @nodes_mutex.synchronize do idx = 0 while !@number_of_nodes || idx < @number_of_nodes unless @nodes[idx] @nodes_cv.wait(@nodes_mutex) next end begin @nodes_mutex.unlock block.call @nodes[idx] ensure @nodes_mutex.lock end idx +=1 end end end |