support lambdas in threads

@amw does this look good ?
I'll try processes next ...


fixed, actually showed that using different mutexes for index and producers
can lead to weird ordering issues ... so just using 1 mutex for everything


On Thu, Aug 21, 2014 at 6:10 AM, Adam Wróbel <notifications@github.com>
wrote:

> In spec/cases/with_lambda.rb:
>
> > @@ -0,0 +1,13 @@
> > +require File.expand_path('spec/spec_helper')
> > +
> > +options = (ARGV[0] == "PROCESSES" ? {:in_processes => 2} : {:in_threads => 2})
> > +options[:mutex] = Mutex.new
> > +all = ['too soon']
> > +produce = lambda { all.shift || Parallel::StopIteration }
> > +options[:mutex].synchronize do
> > +  all.replace(['locked'])
> > +  sleep 1
> > +  all.replace([1,2,3])
> > +end
>
> This block has finished executing by now. You're not testing anything with
> it.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/grosser/parallel/pull/107/files#r16537288>.
>