Skip to content

BUG/Feature request - wait until all tasks are complete #2

@truekonrads

Description

@truekonrads

Hello,

I have an eventually finite amount of tasks which need to be processed. My code goes like this:

pool = ActionPool::Pool.new
 tasks.each do |t|
 pool.queue Proc.new {
  ...
}
end 
while pool.working >0        
         sleep 1
       end
       pool.shutdown

I see this as a bit of hack, surely something like that should be part of the pool code. For example:

class Pool
  def wait_finish(pollint=1)
   while self.working >0
   sleep pollint
  end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions