chef

https://github.com/opscode/chef

Ruby

A systems integration framework, built to bring the benefits of configuration management to your entire infrastructure.

Chef::ChefFS::Parallelizer::ParallelEnumerable#finished?

This is thread safe only if called from the main thread pulling on each().
The order of these checks is important, as well, to be thread safe.
1. If @unconsumed_input.empty? is true, then we will never have any more
work legitimately picked up.
2. If @in_process == 0, then there is no work in process, and because ofwhen unconsumed_input is empty, it will never go back up, because
this is called after the input enumerator is finished.  Note that switching #2 and #1
could cause a race, because in_process is incremented *before* consuming input.
3. If @unconsumed_output.empty? is true, then we are done with outputs.
Thus, 1+2 means no more output will ever show up, and 3 means we've passed all
existing outputs to the user.

Source | Google | Stack overflow

Edit

git clone [email protected]:opscode/chef.git

cd chef

open lib/chef/chef_fs/parallelizer/parallel_enumerable.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Chef--ChefFS--Parallelizer--ParallelEnumerable-finished--for-pr


# Commit to git

git add lib/chef/chef_fs/parallelizer/parallel_enumerable.rbgit commit -m "better docs for Chef::ChefFS::Parallelizer::ParallelEnumerable#finished?"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Chef--ChefFS--Parallelizer--ParallelEnumerable-finished--for-pr

hub pull-request


# Celebrate!