Performer
gem install performer
Performer is a tiny gem for scheduling blocks in a background thread, and optionally waiting for the return value.
Usage
performer = Performer.new
result = performer.sync { 2 + 1 }
result # => 3
future = performer.async { 2 + 1 }
future.value # => 3
future = performer.shutdown do
puts "Performer has been properly shutdown."
end
future.value # wait for shutdown
See documentation for Performer and Performer::Task.