input: stats: fix data-race
commit357b235eca00dd6ba6de18098453ebabfa486b29
authorThomas Guillem <thomas@gllm.fr>
Tue, 1 Oct 2019 13:49:36 +0000 (1 15:49 +0200)
committerThomas Guillem <thomas@gllm.fr>
Wed, 2 Oct 2019 12:26:07 +0000 (2 14:26 +0200)
treefc2b68b0c7e53933b4220a4e0240c3aad99858cf
parent542b55d6f4ee520401053dc014769e78c9b03175
input: stats: fix data-race

Locks were used for reading but not for writting.

WARNING: ThreadSanitizer: data race (pid=1969)
  Write of size 8 at 0x7b3c000005c8 by thread T6:
    #0 input_rate_Add ../../src/input/stats.c:122 (libvlccore.so.9+0x93036)
    #1 AStreamReadBlock ../../src/input/access.c:239 (libvlccore.so.9+0x55591)
    #2 vlc_stream_ReadRaw ../../src/input/stream.c:439 (libvlccore.so.9+0x9333d)
    #3 vlc_stream_ReadPartial ../../src/input/stream.c:462 (libvlccore.so.9+0x938e2)
    #4 ThreadRead ../../modules/stream_filter/prefetch.c:89 (libprefetch_plugin.so+0x2f8d)
    #5 Thread ../../modules/stream_filter/prefetch.c:253 (libprefetch_plugin.so+0x336f)

  Previous read of size 8 at 0x7b3c000005c8 by thread T4 (mutexes: write M121):
    #0 input_stats_Compute ../../src/input/stats.c:84 (libvlccore.so.9+0x92e4f)
    #1 MainLoopStatistics ../../src/input/input.c:638 (libvlccore.so.9+0x75225)
    #2 MainLoop ../../src/input/input.c:724 (libvlccore.so.9+0x7d8ac)
    #3 Run ../../src/input/input.c:465 (libvlccore.so.9+0x7db97)
src/input/stats.c