Commit Graph

16 Commits

Author SHA1 Message Date
ReinUsesLisp 08ad5c4e42 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.
2020-10-28 01:41:24 -03:00
Fernando Sahmkow 94a51e6b21 Core/Common: Address Feedback. 2020-06-27 18:20:06 -04:00
Fernando Sahmkow 1460bdc5ab Common/Fiber: Implement Rewinding. 2020-06-18 16:29:25 -04:00
Fernando Sahmkow 564713fb46 Common/Tests: Address Feedback 2020-06-18 16:29:21 -04:00
Fernando Sahmkow 09d2ffa663 Common/Tests: Clang Format. 2020-06-18 16:29:19 -04:00
Fernando Sahmkow a1e7931d20 Common: Polish Fiber class, add comments, asserts and more tests. 2020-06-18 16:29:15 -04:00
Fernando Sahmkow 279ff1c0ff Tests: Add tests for fibers and refactor/fix Fiber class 2020-06-18 16:29:15 -04:00
Fernando Sahmkow 1e7fd04059 Fixes and corrections on formatting. 2019-03-27 14:49:43 -04:00
Fernando Sahmkow 8fd9babe62 Add MultiLevelQueue Tests 2019-03-27 14:34:31 -04:00
Fernando Sahmkow 10cedd8bd7 Implement intrinsics CountTrailingZeroes and test it. 2019-03-27 14:34:29 -04:00
Weiyi Wang a2fa901591 common/bitfield: make it endianness-aware 2019-02-06 17:29:39 +01:00
fearlessTobi 1190ea6ddb Port #4182 from Citra: "Prefix all size_t with std::" 2018-09-15 15:21:06 +02:00
MerryMage 62e2e0a8fb common: Implement a ring buffer 2018-09-08 18:56:38 +01:00
Lioncash a7798e834a externals: Update catch to 2.3.0
Updates the library from 2.2.3 to 2.3.0
2018-08-07 19:26:13 -04:00
James Rowe ea88c44eb8 Format: Run the new clang format on everything 2018-01-20 16:45:11 -07:00
wwylele 11e73d554f Common: add ParamPackage 2017-03-01 23:30:57 +02:00