[vlc-devel] [PATCH] non-blocking filewriter (version 2)

Rémi Denis-Courmont remi at remlab.net
Wed Apr 29 17:53:49 CEST 2009


Le mercredi 29 avril 2009 14:08:16 Jarmo Torvinen, vous avez écrit :
>   -> do you see any issues in using the block_FifoCount() as it is
> commented as being not thread safe in block.c? I guess in theory the
> Write() function could delete too many blocks when

Generally, it is not thread-safe if more than one thread where pushing or 
pulling packets from the FIFO. Here, it's not really an issue. At worse you'll 
delete "too many" packets indeed.

Now, I think you have a memory leak in blocking mode though. You should only 
create the FIFO in non-blocking mode, and then you don't need the boolean 
anymore.

> There is still one warning on compilation:
>
> file.c: In function ?ThreadWrite?:
> file.c:234: warning: variable ?p_buffer? might be clobbered by ?longjmp?
> or ?vfork?

volatile would kill the warning. But it's really a GCC bug, as the variable 
will _not_ be used in the event of longjmp(). volatile would hence prevent 
harmless optimizations.

> Which I'm not quite sure how to fix. I guess making the block_t *p_buffer;
> volatile isn't the correct solution.

It would be the correct solution if we were truly using longjmp().

-- 
Rémi Denis-Courmont
http://www.remlab.net/




More information about the vlc-devel mailing list