Last active
December 13, 2017 08:19
-
-
Save privefl/fca97600eac422681aa5b52c0bfd4f7e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#### IN ORDER #### | |
# In first session, run: | |
write(1, "test.txt") | |
obj.lock <- flock::lock("test.txt") | |
# In second session, run this (this will wait the unlock in the first session) | |
obj.lock <- flock::lock("test.txt") | |
write(2, "test.txt", append = TRUE) | |
flock::unlock(obj.lock) | |
# Then run this in first session (session 2 will run when unlocking) | |
write(3, "test.txt", append = TRUE) | |
flock::unlock(obj.lock) | |
# Verif in any session (3 is written before 2) | |
readLines("test.txt") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment