##- # Author: Brian Tiffin # Dedicated to the public domain # # Date: October 2016 # Modified: 2016-10-09/10:49-0400 ##+ # # flock.icn, demonstrate the POSIX flock advisory file locking function # procedure main() fn := "newfile.txt" f := open(fn, "r") write("requesting lock for ", fn) if flock(f, "xb") then write("got exclusive lock on ", fn) else write("lock attempt on ", fn, " failed") flock(f, "u") close(f) end