diff options
Diffstat (limited to 'src/flocker.py')
| -rw-r--r-- | src/flocker.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/flocker.py b/src/flocker.py index 8965ee2..4503354 100644 --- a/src/flocker.py +++ b/src/flocker.py @@ -21,6 +21,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. import fcntl +def touch(file): + file = open(file, 'a') + file.flush() + return file + + def flock(file, exclusive, nonblocking = False): locktype = (fcntl.LOCK_EX if exclusive else fcntl.LOCK_SH) | (fcntl.LOCK_NB if nonblocking else 0) fcntl(file.fileno(), locktype) |
