Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

e-threadpool

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

e-threadpool

  • 1.3.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Threadpool

Threadpool is the "threadpool pattern" implemented in ruby. It's a compact but robust component.

Features

  • Timeout jobs, it means the stuck threads will be recycled.
  • Job based tasks, job is an object not a block, could be more flexible.
  • MRI and JRuby are supported.

Install

Edit Gemfile

...
gem 'e-threadpool'
...

or

gem install e-threadpool

Example

require 'threadpool'

class TestJob < Job
  def run
    puts "hello"
  end
end

threadpool = Threadpool.new
100.times.each do
  # threadpool auto-executes the job after loaded
  threadpool.load(TestJob.new)
  # Sleep 10ms, prevent ouput too fast on console.
  sleep(0.01)
end

# shutdown will wait until all jobs are finished
threadpool.shutdown

License

MIT LICENSE, please refer to the LICENSE file.

FAQs

Package last updated on 11 Dec 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc