diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2001-09-30 10:38:06 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2001-09-30 10:38:06 +0200 |
commit | a0d04288c6cf76294772ec000a90f423dab3edbe (patch) | |
tree | 2b0beeff97cb7140b884d0eb11ba509d057f0345 /recording.c | |
parent | 0dc2e82f9a48909847525a969bdc04e9aaa9cc9f (diff) | |
download | vdr-a0d04288c6cf76294772ec000a90f423dab3edbe.tar.gz vdr-a0d04288c6cf76294772ec000a90f423dab3edbe.tar.bz2 |
Lock file for accessing the video directory
Diffstat (limited to 'recording.c')
-rw-r--r-- | recording.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/recording.c b/recording.c index df504074..11fb851e 100644 --- a/recording.c +++ b/recording.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: recording.c 1.37 2001/09/23 13:43:29 kls Exp $ + * $Id: recording.c 1.38 2001/09/30 10:29:11 kls Exp $ */ #define _GNU_SOURCE @@ -45,6 +45,10 @@ void RemoveDeletedRecordings(void) { static time_t LastRemoveCheck = 0; if (time(NULL) - LastRemoveCheck > REMOVECHECKDELTA) { + // Make sure only one instance of VDR does this: + cLockFile LockFile(VideoDirectory); + if (!LockFile.Lock()) + return; // Remove the oldest file that has been "deleted": cRecordings Recordings; if (Recordings.Load(true)) { @@ -74,6 +78,10 @@ void AssertFreeDiskSpace(int Priority) static time_t LastFreeDiskCheck = 0; if (time(NULL) - LastFreeDiskCheck > DISKCHECKDELTA) { if (!VideoFileSpaceAvailable(MINDISKSPACE)) { + // Make sure only one instance of VDR does this: + cLockFile LockFile(VideoDirectory); + if (!LockFile.Lock()) + return; // Remove the oldest file that has been "deleted": cRecordings Recordings; if (Recordings.Load(true)) { |