lock {flock} | R Documentation |
Locks a file in exclusive or shared mode.
lock(path, exclusive = TRUE)
path |
Character. The path. |
exclusive |
Logical. The lock type, exclusive or shared. |
The file is created if it doesn't exist.
Returns an object of type FileLock
, which is to be
used for the unlock
call.
Ivan Popivanov
## Not run:
require(flock)
file.lock = lock("~/file.lock")
# Critical section code goes here
unlock(file.lock)
## End(Not run)