[vlc-devel] [vlc-commits] addons: fix threading and cancelable sections

Rémi Denis-Courmont remi at remlab.net
Thu Feb 20 20:26:18 CET 2014


Le jeudi 20 février 2014, 20:10:37 Steinar H. Gunderson a écrit :
> On Thu, Feb 20, 2014 at 09:04:43PM +0200, Rémi Denis-Courmont wrote:
> > How do you convince developers to use the would-be vlc_wait_for() macro
> > instead of vlc_cond_wait()? Removing the latter is not really an option.
> 
>  1. Convert all existing code (where it makes sense). People tend to copy
> code from other places when they write new code and are not intimately
> familiar with the given APIs.

There are plenty of cases where it does _not_ make sense, notably long loops.

Besides, I think I killed all the counter examples and complained about all 
the new ones since then. And yet developers still reproduce the antipattern.

>  2. Add a warning to vlc_cond_wait() saying that using vlc_wait_for()
> instead will likely save you a world of pain.

The proper practice is already documented with an example in the function 
Doxygen comments. This only occurs because developers do not read the 
documentation, so adding documentation is unlikely to fix the problem.

> Not perfect, I admit, and especially #1 is probably a significant chunk of
> work.

I rather think this is a cultural problem. This project started as a hack way 
back when and some bad practices just won't die :-(

-- 
Реми Денис-Курмон
http://www.remlab.net/




More information about the vlc-devel mailing list