Udo Richter wrote:
Klaus Schmidinger wrote:
There are two ways this could be done. First, by adding a function SoftCancel() { running=false; }. Or second, by modifying Cancel() to just set running=false if called with Cancel(-1) or Cancel(0,false) or similar.

I would prefer using -1 as a special value for this, because this
wouldn't require an interface change.

Agreed. I don't think that someone ever called Cancel(-1) before, so it should be ok to use that.

Btw: This one is shorter and functionally identical:

--- thread.c.old    2006-08-20 16:41:09.273625000 +0200
+++ thread.c    2006-09-24 14:22:59.064500000 +0200
@@ -293,7 +293,7 @@
 void cThread::Cancel(int WaitSeconds)
   running = false;
-  if (active) {
+  if (active && WaitSeconds > -1) {
      if (WaitSeconds > 0) {
         for (time_t t0 = time(NULL) + WaitSeconds; time(NULL) < t0; ) {
             if (!Active())

Well, that's fine with me, too.

I guess you'll also want me to increase the API version number
if this goes into version 1.4.4?


vdr mailing list

Reply via email to