Sha256: d66054bb21720399312cad0ada796a82fdd8c82546dfafb7f5f9766a5a73877a

Contents?: true

Size: 449 Bytes

Versions: 1

Compression:

Stored size: 449 Bytes

Contents

module Concurrent

  class PerThreadExecutor

    def self.post(*args)
      raise ArgumentError.new('no block given') unless block_given?
      Thread.new(*args) do
        Thread.current.abort_on_exception = false
        yield(*args)
      end
      return true
    end

    def post(*args, &task)
      return PerThreadExecutor.post(*args, &task)
    end

    def <<(task)
      PerThreadExecutor.post(&task)
      return self
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
concurrent-ruby-0.6.0.pre.2 lib/concurrent/executor/per_thread_executor.rb