summaryrefslogtreecommitdiff
path: root/cutter.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2012-09-22 11:52:33 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2012-09-22 11:52:33 +0200
commit72c03260d77a0de52ed57992e374f26211fe2063 (patch)
treeea61de60ff2567caee18e1b4a2afbb563de56e6f /cutter.c
parente898a28258ac97cc15f875fb8fa9b274266f6d01 (diff)
downloadvdr-72c03260d77a0de52ed57992e374f26211fe2063.tar.gz
vdr-72c03260d77a0de52ed57992e374f26211fe2063.tar.bz2
The new class cIoThrottle is used to allow I/O intense threads to temporarily suspend their activities in case buffers run full
Diffstat (limited to 'cutter.c')
-rw-r--r--cutter.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/cutter.c b/cutter.c
index 62eae822..bcae2b72 100644
--- a/cutter.c
+++ b/cutter.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: cutter.c 2.13 2012/06/10 14:33:36 kls Exp $
+ * $Id: cutter.c 2.14 2012/09/20 09:12:47 kls Exp $
*/
#include "cutter.h"
@@ -88,12 +88,28 @@ void cCuttingThread::Action(void)
bool CheckForSeamlessStream = false;
bool LastMark = false;
bool cutIn = true;
+ bool suspensionLogged = false;
while (Running()) {
uint16_t FileNumber;
off_t FileOffset;
int Length;
bool Independent;
+ // Suspend cutting if we have severe throughput problems:
+
+ if (cIoThrottle::Engaged()) {
+ if (!suspensionLogged) {
+ dsyslog("suspending cutter thread");
+ suspensionLogged = true;
+ }
+ cCondWait::SleepMs(100);
+ continue;
+ }
+ else if (suspensionLogged) {
+ dsyslog("resuming cutter thread");
+ suspensionLogged = false;
+ }
+
// Make sure there is enough disk space:
AssertFreeDiskSpace(-1);