[vdr] vdr-xine: what's wrong with this piece of code -- threading
issue?
Reinhard Nissl
rnissl at gmx.de
Fri Mar 25 09:38:44 CET 2005
Hi,
Stefan Taferner wrote:
>>I'm facing a deadlock situation, when the below code is modified to
>>ignore the "r == 0" cases (= original code in vdr-xine-0.7.2):
>
> r==0 means that there is no data available. Are you sure you want
> to block in xread until data is available?
Yes, because there is nothing else to do at that point in time.
This function is used to retrieve the result of a "remote procedure
call" (e. g. in execFuncGetPTS()).
> If you want to ignore the r==0 cases, why don't you simply open
> the file in blocking mode (remove O_NONBLOCK from xineLib.c:2160) ?
O_NONBLOCK is just used to be able to open the FIFO while xine still
needs to connect to the FIFO. After opening the FIFOs, O_NONBLOCK is
removed in lines 2164 and 2165.
But the FIFO used in the above example (fd_result) has never been
opended nonblocking (see line 2162).
> If you want to wait for data (and keep the non-blocking) you should wait some
> time (200ms or so). If you are not sure about the cPoller, use the select
> function with a timeout. Then you get exact error codes and all that.
All I'd like to do is to block until the requested data is ready and "r
== 0" should just indicate that the FIFO was closed by xine.
But for any reason, "r == 0" happens still without the FIFO beeing
closed. Can someone tell me, how to handle this situation properly?
Bye.
--
Dipl.-Inform. (FH) Reinhard Nissl
mailto:rnissl at gmx.de
More information about the vdr
mailing list