mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Removing deleted recordings is now done in a separate thread
This commit is contained in:
parent
967d9b0b03
commit
fbddcb2fd6
3
HISTORY
3
HISTORY
@ -3963,7 +3963,7 @@ Video Disk Recorder Revision History
|
|||||||
commands may now be executed at any time, and the message will be displayed
|
commands may now be executed at any time, and the message will be displayed
|
||||||
(no more "pending message").
|
(no more "pending message").
|
||||||
|
|
||||||
2005-12-27: Version 1.3.38
|
2005-12-28: Version 1.3.38
|
||||||
|
|
||||||
- Fixed handling second audio and Dolby Digital PIDs for encrypted channels
|
- Fixed handling second audio and Dolby Digital PIDs for encrypted channels
|
||||||
(was broken in version 1.3.37).
|
(was broken in version 1.3.37).
|
||||||
@ -4006,3 +4006,4 @@ Video Disk Recorder Revision History
|
|||||||
now immediately creates a timer for the selected event and marks it with 'T'.
|
now immediately creates a timer for the selected event and marks it with 'T'.
|
||||||
If the event is already marked with 'T', the "Red" button opens the "Edit
|
If the event is already marked with 'T', the "Red" button opens the "Edit
|
||||||
timer" menu for that timer.
|
timer" menu for that timer.
|
||||||
|
- Removing deleted recordings is now done in a separate thread.
|
||||||
|
47
recording.c
47
recording.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: recording.c 1.129 2005/12/18 13:38:30 kls Exp $
|
* $Id: recording.c 1.130 2005/12/28 12:19:16 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "recording.h"
|
#include "recording.h"
|
||||||
@ -62,16 +62,28 @@ bool VfatFileSystem = false;
|
|||||||
|
|
||||||
cRecordings DeletedRecordings(true);
|
cRecordings DeletedRecordings(true);
|
||||||
|
|
||||||
void RemoveDeletedRecordings(void)
|
// --- cRemoveDeletedRecordingsThread ----------------------------------------
|
||||||
|
|
||||||
|
class cRemoveDeletedRecordingsThread : public cThread {
|
||||||
|
protected:
|
||||||
|
virtual void Action(void);
|
||||||
|
public:
|
||||||
|
cRemoveDeletedRecordingsThread(void);
|
||||||
|
};
|
||||||
|
|
||||||
|
cRemoveDeletedRecordingsThread::cRemoveDeletedRecordingsThread(void)
|
||||||
|
:cThread("remove deleted recordings")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void cRemoveDeletedRecordingsThread::Action(void)
|
||||||
{
|
{
|
||||||
static time_t LastRemoveCheck = 0;
|
|
||||||
if (time(NULL) - LastRemoveCheck > REMOVECHECKDELTA) {
|
|
||||||
cThreadLock DeletedRecordingsLock(&DeletedRecordings);
|
|
||||||
for (cRecording *r = DeletedRecordings.First(); r; ) {
|
|
||||||
if (r->deleted && time(NULL) - r->deleted > DELETEDLIFETIME) {
|
|
||||||
// Make sure only one instance of VDR does this:
|
// Make sure only one instance of VDR does this:
|
||||||
cLockFile LockFile(VideoDirectory);
|
cLockFile LockFile(VideoDirectory);
|
||||||
if (LockFile.Lock()) {
|
if (LockFile.Lock()) {
|
||||||
|
cThreadLock DeletedRecordingsLock(&DeletedRecordings);
|
||||||
|
for (cRecording *r = DeletedRecordings.First(); r; ) {
|
||||||
|
if (r->deleted && time(NULL) - r->deleted > DELETEDLIFETIME) {
|
||||||
cRecording *next = DeletedRecordings.Next(r);
|
cRecording *next = DeletedRecordings.Next(r);
|
||||||
r->Remove();
|
r->Remove();
|
||||||
DeletedRecordings.Del(r);
|
DeletedRecordings.Del(r);
|
||||||
@ -79,9 +91,28 @@ void RemoveDeletedRecordings(void)
|
|||||||
RemoveEmptyVideoDirectories();
|
RemoveEmptyVideoDirectories();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
r = DeletedRecordings.Next(r);
|
r = DeletedRecordings.Next(r);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static cRemoveDeletedRecordingsThread RemoveDeletedRecordingsThread;
|
||||||
|
|
||||||
|
// ---
|
||||||
|
|
||||||
|
void RemoveDeletedRecordings(void)
|
||||||
|
{
|
||||||
|
static time_t LastRemoveCheck = 0;
|
||||||
|
if (time(NULL) - LastRemoveCheck > REMOVECHECKDELTA) {
|
||||||
|
if (!RemoveDeletedRecordingsThread.Active()) {
|
||||||
|
cThreadLock DeletedRecordingsLock(&DeletedRecordings);
|
||||||
|
for (cRecording *r = DeletedRecordings.First(); r; r = DeletedRecordings.Next(r)) {
|
||||||
|
if (r->deleted && time(NULL) - r->deleted > DELETEDLIFETIME) {
|
||||||
|
RemoveDeletedRecordingsThread.Start();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
LastRemoveCheck = time(NULL);
|
LastRemoveCheck = time(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user