[ruby-talk:444755] [ANN] lockf.rb v3.0.0 Released
# About lockf.rb offers Ruby bindings for the advisory-mode lock provided by the lockf(3) function. It is similar to flock(2) in spirit but it also has semantic differences that can be desirable when used across the fork(2) boundary and that is usually the main reason to use this library. # Example #!/usr/bin/env ruby require "lockf" pids = [] lockf = Lockf.unlinked 5.times do pids << fork { puts "Wait for lock (pid #{Process.pid})" lockf.synchronize do puts "Lock acquired (pid #{Process.pid})" sleep 5 end } end pids.each { Process.wait(it) } ## # Wait for lock (pid 12345) # Lock acquired (pid 12345) # ... # Links https://github.com/0x1eef/lockf.rb https://rubygems.org/gems/lockf.rb Best regards, Robert
participants (1)
-
Robert