Socket
Book a DemoInstallSign in
Socket

thread_tools

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

thread_tools

0.28
bundlerRubygems
Version published
Maintainers
1
Created
Source

= thread_tools

  • http://github.com/differential/thread_tools

== DESCRIPTION:

A collection of utilities that I often use for threaded code.

== FEATURES:

  • Thread pool
  • Mongrel patch (thread pool)
  • Semaphore
  • Debug mutex

== SYNOPSIS:

  • Bounded thread pool require 'thread_tools/threadpool'

tpool = ThreadTools::ThreadPool.new(2) 10.times {|i| tpool.spawn(i) {|ti| puts "#{Thread.current} => #{ti}" } } tpool.shutdown

  • Stupid simple semaphore require 'thread_tools/semaphore'

sem = ThreadTools::Semaphore.new(1) sem.acquire sem.release

  • Thread pool for Mongrel require 'mongrel' require 'thread_tools/mongrel_pool'

server = Mongrel::HttpServer.new(host, port) server.run(10).join

  • An annoying mutex require 'thread_tools/debugmutex' mtxA = ThreadTools::DebugMutex.new mtxB = ThreadTools::DebugMutex.new begin mtxA.lock mtxB.lock mtxA.unlock # <= kboom!!! rescue

    Warning, the next line unlocks all mutex acquired by this thread

    ThreadTools::DebugMutex.unlock_all(Thread.current) end

== REQUIREMENTS:

  • Mongrel patch requires mongrel (duh)
  • Rake if you want to run the test cases

== INSTALL:

gem install thread_tools or gem build thread_tools.gemspec gem install thread_tools-.gem

== LICENSE:

see LICENSE

FAQs

Package last updated on 14 Oct 2009

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.