jdantonio/concurrent-ruby — pull request #52 by jdantonio (2014-04-11 21:13:07+00:00)
Title: Implemented TimerSet executor and updated Concurrent::timer

@mighe I've updated Concurrent::timer based on your suggestion. I think this implementation is much better. Please feel free to update if you think it can be optimized more. Here's what I did:

* Implemented a pure Ruby, not thread safe, `MutexPriorityQueue` class based on [Sedgewick and Wayne](http://algs4.cs.princeton.edu/24pq/index.php#2.6)
* Implemented a `JavaPriorityQueue` wrapper for `java.util.PriorityQueue`
* Created a `PriorityQueue` class that maps to either the Ruby or Java implementation as appropriate
* Created a new `TimerSet` executor that follows your suggested algorithm (puts all tasks in a priority queue based on absolute time then posts tasks to a thread pool)
* Implemented a few optimizations in `TimerSet` such as lazy starting of the monitor thread, letting the monitor thread die when not being used, and support for the `:executor` option on construction
* Mapped the global task pool behind `Concurrent::timer` to a `TimerSet`