LockedProcess
Locked process is a way of executing a Thread but preventing the same Thread from being executed while the first one is still running.
Instalation
gem install 'locked_process'
Usage
require 'locked_process'
process = LockedProcess.new('/tmp/download_images.pid') do
MyImageDownloader.new.download
end
process.execute # executes MyImageDownloader.new.download in a Thread
# if the process is still running
process.execute # raises LockedProcess::Error
Author
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) Do not forget to write tests - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request