## Not run:
# require(flock)
#
# file.lock = lock("~/file.lock")
# # Critical section code goes between here and the unlock call
# if(is.locked(file.lock)) {
# print("Got the lock!")
# }
# unlock(file.lock)
# ## End(Not run)
Run the code above in your browser using DataLab