aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/command_classes/codecs/vp9.cpp
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2020-10-28 01:33:57 -0300
committerReinUsesLisp <reinuseslisp@airmail.cc>2020-10-28 01:41:24 -0300
commit08ad5c4e4245586e770b7edcf1983497e25b7489 (patch)
tree00cc711665f8137de1ac4f91dd2b10c1c982b682 /src/video_core/command_classes/codecs/vp9.cpp
parentc82b1f691718a4e4ba1cbe515bb7218d032f581d (diff)
tests: Fix data race in fibers test
Previous to this commit, the tests were using operator[] from unordered_map to query elements but this silently inserts empty elements when they don't exist. If all threads were executed without concurrency, this wouldn't be an issue, but the same unordered_map could be written from two threads at the same time. This is a data race and makes some previously inserted elements invisible for a short period of time, causing them to insert and return an empty element. This default constructed element (a zero) was used to index an array of fibers that asserted when one of them was nullptr, shutting the test session off. To address this issue, lock on thread id reads and writes. This could be a shared mutex to allow concurrent reads, but the definition of std::this_thread::get_id is fuzzy when using non-standard techniques like fibers. I opted to use a standard mutex. While we are at it, fix the included headers.
Diffstat (limited to 'src/video_core/command_classes/codecs/vp9.cpp')
0 files changed, 0 insertions, 0 deletions