with_locking:使用 PID 文件锁定进程

时间:2021-06-27 12:00:27
【文件属性】:
文件名称:with_locking:使用 PID 文件锁定进程
文件大小:5KB
文件格式:ZIP
更新时间:2021-06-27 12:00:27
Ruby 带锁 使用 pid 文件创建互斥锁的 gem。 安装 将此行添加到应用程序的 Gemfile 中: gem 'with_locking' 或者自己安装: $ gem install with_locking 用法 一个代码块可以像这样执行: WithLocking.run { puts "this code is locked!" } 或者,使用可选名称(推荐)运行代码块,这样可以调用具有不同名称的多个 WithLocking 块而不会发生冲突: WithLocking.run(name: "sleeper") { sleep 60 } WithLocking.run(name: "sleeper") do puts "I won't execute and will return false because 'sleeper' is sti
【文件预览】:
with_locking-master
----.gitignore(160B)
----LICENSE(1KB)
----spec()
--------with_locking_spec.rb(4KB)
----README.md(1KB)
----with_locking.gemspec(1KB)
----lib()
--------with_locking.rb(1KB)
--------with_locking()
----Gemfile(38B)
----Rakefile(48B)

网友评论