mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-03-14 21:00:17 +00:00
Ensure we wait for the test thread to be dead on PartialUnmap
This commit is contained in:
parent
1725e03bda
commit
3fe5a709bb
1 changed files with 7 additions and 3 deletions
|
@ -78,11 +78,13 @@ namespace Ryujinx.Tests.Memory
|
||||||
|
|
||||||
ref var state = ref PartialUnmapState.GetRef();
|
ref var state = ref PartialUnmapState.GetRef();
|
||||||
|
|
||||||
|
Thread testThread = null;
|
||||||
|
bool shouldAccess = true;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Globally reset the struct for handling partial unmap races.
|
// Globally reset the struct for handling partial unmap races.
|
||||||
PartialUnmapState.Reset();
|
PartialUnmapState.Reset();
|
||||||
bool shouldAccess = true;
|
|
||||||
bool error = false;
|
bool error = false;
|
||||||
|
|
||||||
// Create a large mapping.
|
// Create a large mapping.
|
||||||
|
@ -93,8 +95,6 @@ namespace Ryujinx.Tests.Memory
|
||||||
memory.Reprotect(0, vaSize, MemoryPermission.Read);
|
memory.Reprotect(0, vaSize, MemoryPermission.Read);
|
||||||
}
|
}
|
||||||
|
|
||||||
Thread testThread;
|
|
||||||
|
|
||||||
if (readOnly)
|
if (readOnly)
|
||||||
{
|
{
|
||||||
// Write a value to the physical memory, then try to read it repeately from virtual.
|
// Write a value to the physical memory, then try to read it repeately from virtual.
|
||||||
|
@ -193,6 +193,10 @@ namespace Ryujinx.Tests.Memory
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
// In case something failed, we want to ensure the test thread is dead before disposing of the memory.
|
||||||
|
shouldAccess = false;
|
||||||
|
testThread?.Join();
|
||||||
|
|
||||||
exceptionHandler.Dispose();
|
exceptionHandler.Dispose();
|
||||||
unusedMainMemory.Dispose();
|
unusedMainMemory.Dispose();
|
||||||
memory.Dispose();
|
memory.Dispose();
|
||||||
|
|
Loading…
Reference in a new issue