I’ve just released a very alpha version of my Ruby on Rails concurrency Gem, Runner. The syntax is simple and doesn’t require any blocks. For example you could run a method in the background with as simple as:
Which forces “my_method” to be executed in the background.
With Runner it’s also possible to queue calls which will be executed at a later given time. For example you would like to do some very CPU intensive, long running method to be executed daily at 12AM:
class User def takes_long_time 2 + 2 # I 'm not kidding! end end # somewhere in your code: user = User.new user.spawn(:method => :queue).takes_long_time # => The method is now queued and won't be run # In a rake task witch is run by cron at night runner = Runner::TaskSpawner.new runner.start_handlers # => All queued tasks are now being forked and run asynch in the background
For more information and features about the Gem please go to the github repo.