[vdr] [RFE] Soft-cancel cThread

Udo Richter udo_richter at gmx.de
Sat Sep 23 19:30:49 CEST 2006


I have a suggestion for a VDR change: I could use a way to end a cThread 
externally without having to wait and without hard canceling it.

My thread runs with the usual while (Running()) loop. To signal the loop 
to stop, it would be enough to set running=false. However, running is a 
private member of cThread. The only way to set running=false is to call 
Cancel(). This involves killing the thread and waiting for the thread to 
terminate. Two things I actually don't want.

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 

As a workaround I'm now using while (Running() && running2) - which is 
imho ugly.

Background: I have to terminate several threads at the same time, and 
calling Cancel(1) sequentially would be a waste of time. I want to set 
running=false on all threads first, and then cancel the remains later.



More information about the vdr mailing list