Mailing List archive

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

[linux-dvb] Re: cinergyT2: which kernel/usb module to use?



Stefan Lucke wrote:
> 
> while (ioctl (something) == 0)
> 	;
> 
> is to my opinion boguous.

In the particular case of the frontend event queue, and
if the frontend is openend O_NONBLOCK the loop will
eventually terminate with EAGAIN.

> bool cDvbTuner::GetFrontendEvent(dvb_frontend_event &Event, int TimeoutMs)
> {
...
>   do {
>      int stat = ioctl(fd_frontend, FE_GET_EVENT, &Event);
>      if (stat == 0)
>         return true; //stefan lucke: ioctl is successful, so return ! the only way to break this loop.
>      if (stat < 0) {
>         if (errno == EINTR)
>            continue;
>         }
>      } while (0);
>   return false; // stefan lucke: this code is unreached !!

Not true, since while(0) won't loop.
But the code is certainly somewhat obfuscated.

Johannes




Home | Main Index | Thread Index