Ticket #87 (closed enhancement: duplicate)

Opened 8 months ago

Last modified 1 week ago

A Smarter Better Threadpool for Eventmachine

Reported by: mebaran Assigned to: raggi
Priority: minor Milestone:
Keywords: defer threads pool Cc:


This is a monkey patch I designed to augment Eventmachine's simple but ineffective threadpooling.


A monitoring thread that maintains the health of the threadpool. An EM based mechanism to timeout threads safely by raising an exception The ability to dynamically increase or decrease the size of the pool. A simple carry to allow you to pass data between the caller and the callback.


A more general signaling mechanism. Canceling of jobs should be available as soon as I have time to delve inside the implementation of the Thread Queue class (which is curiously devoid of any instance variables....)

To Do:

Figure out some comprehensive tests Research a way to avoid the use of Thread.exclusive

The goodness is handled by a call to EM.schedule which transparently sets up the scheduler if necessary. Pass in a lambda and set the callback for the result, errback to work with exceptions if execution goes awry, and hash options. Current thread options include timeout to kill a thread if it hangs too long and carry which allows the caller to pass independent information to the callback.


scheduler.rb (3.7 kB) - added by mebaran on 10/10/08 16:20:38.
Implemenation of an eventmachine based scheduler.

Change History

10/10/08 16:20:38 changed by mebaran

  • attachment scheduler.rb added.

Implemenation of an eventmachine based scheduler.

01/27/09 20:15:17 changed by raggi

  • owner set to raggi.
  • status changed from new to assigned.

Need to investigate

05/25/09 10:51:54 changed by yakischloba

  • status changed from assigned to closed.
  • resolution set to duplicate.

Moved to Github Issues