[RFE] Soft-cancel cThread

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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())



Cheers,

Udo


[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux