Sha256: bce9cf71e23f505f6ade973c66e91f4457ba93b47d3f048e1e31962b591ccd60

Contents?: true

Size: 332 Bytes

Versions: 5

Compression:

Stored size: 332 Bytes

Contents

class PgExport
  module Concurrency
    class ThreadsArray < Array
      def <<(job)
        super Thread.new { job }
      end

      alias push <<
    end

    def self.included(*)
      Thread.abort_on_exception = true
    end

    def concurrently
      t = ThreadsArray.new
      yield t
      t.each(&:join)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pg_export-0.4.1 lib/pg_export/concurrency.rb
pg_export-0.4.0 lib/pg_export/concurrency.rb
pg_export-0.3.2 lib/pg_export/concurrency.rb
pg_export-0.3.1 lib/pg_export/concurrency.rb
pg_export-0.3.0 lib/pg_export/concurrency.rb