diff --git a/lib/celluloid/pmap.rb b/lib/celluloid/pmap.rb index f314907..7b796d4 100644 --- a/lib/celluloid/pmap.rb +++ b/lib/celluloid/pmap.rb @@ -12,6 +12,8 @@ def pmap(size=Celluloid.cores, &block) pool = Pmap::ParallelMapWorker.pool(size: size) futures = map { |elem| pool.future :yielder, elem, &block } futures.map { |future| future.value } + ensure + pool.terminate end end