On 23/10/17 03:56, Michael Niedermayer wrote:
> the initialization should be thread safe as it never writes a different
> value in the same spot

This is not true; please be very careful with assumptions like this.

The C standard calls this a data race and it is undefined behaviour.

It is not just a theoretical concern, either - on architectures with 
destructive write-hint instructions ("fill cache line with unspecified data 
without loading it from memory, because I'm about to overwrite all of it", 
exactly what you want to use (and therefore the compiler will generate) to 
avoid pointless loads when overwriting a large table) other threads can and do 
see different contents transiently when the same data is written to the 
location.

- Mark
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to