Let's say we have two different notebooks
note2.nb performing calculations on two different kernels simultaneously. Both of them need to access and write to a file
file.txt. However, clearly they cannot write to the file simultaneously, so each should implement a waiting loop for as long as
file.txt is being used by the other notebook. To do that, we need a way to determine in Mathematica whether
file.txt is currently being used or not.
Therefore, my question is:
Is there a function in Mathematica that determines whether a file is currently being used by a different process? (By a different Mathematica kernel in particular?)
Perhaps there is some convenient workaround way of determining that? Thanks for any suggestion!