[mythtv] HandleGetNextFreeRecorder question

Carl Reynolds mythtv-dev at hyperbole-software.com
Fri Sep 16 16:53:19 UTC 2005

In programs/mythbackend/mainserver.cpp is a function called 
'HandleGetNextFreeRecorder". The main part of this function is a loop 
that looks at each of the recorders in 'encoderList'. Before entering 
the list the function sets the value of  two iterators, 'iter' and 
'curr', and sets 'retval' to -1. It looks at each encoder in the list to 
see if it is available. If an encorder is free, the function sets the 
value of 'retval' to a positive value and continues looping through the 
list until 'iter' is once again equal to 'curr';

Since the function check the value of 'retval' to see if it equals -1 
before checking each recorder, the function doesn't check for any free 
encoders after it has found one that is free.

Would it not be possible to break out of the loop once the function has 
found a free encoder?    ....    Is there a reason the function 
continues to loop through the rest of the list?    ....    What logic am 
I missing here?

There is similar logic in a function called 'HandleGetFreeRecorder' in 
the same file, but there is an additional check for 'lastcard' in the 
loop of this function. Would breaking out of the loop in 
'HandleGetFreeRecorder' cause the 'lastcard' logic not to work?


More information about the mythtv-dev mailing list