From 027e421271d4c56faa0933e291595346fbb6a409 Mon Sep 17 00:00:00 2001 From: ParantezTech <12572227+par274@users.noreply.github.com> Date: Fri, 2 Oct 2026 19:55:12 +0300 Subject: [PATCH] [PhtreadSpecificSemanticsTests] Fixes for computed shaders --- .../Pthread/PthreadSpecificSemanticsTests.cs | 36 +++++++++++-------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/tests/SharpEmu.Libs.Tests/Pthread/PthreadSpecificSemanticsTests.cs b/tests/SharpEmu.Libs.Tests/Pthread/PthreadSpecificSemanticsTests.cs index f7dabba..453e157 100644 --- a/tests/SharpEmu.Libs.Tests/Pthread/PthreadSpecificSemanticsTests.cs +++ b/tests/SharpEmu.Libs.Tests/Pthread/PthreadSpecificSemanticsTests.cs @@ -112,23 +112,31 @@ public sealed class PthreadSpecificSemanticsTests var key = CreateKey(context, MemoryBase + 0x4_0100); Assert.Equal(0, Setspecific(context, key, 0x1111UL)); - // Blocking wait, not await: pthread-specific storage is keyed by the - // calling thread, and an await continuation can resume on a different - // pool thread, which would change what "this thread" means mid-test. - var other = Task.Factory.StartNew( - () => + ulong seen = 0; + ulong mine = 0; + var setResult = -1; + Exception? failure = null; + var other = new Thread(() => + { + try { var otherContext = new CpuContext(memory, Generation.Gen5); - var seen = Getspecific(otherContext, key); - Assert.Equal(0, Setspecific(otherContext, key, 0x2222UL)); - return (seen, mine: Getspecific(otherContext, key)); - }, - CancellationToken.None, - TaskCreationOptions.LongRunning, - TaskScheduler.Default).GetAwaiter().GetResult(); + seen = Getspecific(otherContext, key); + setResult = Setspecific(otherContext, key, 0x2222UL); + mine = Getspecific(otherContext, key); + } + catch (Exception exception) + { + failure = exception; + } + }); + other.Start(); + other.Join(); - Assert.Equal(0UL, other.seen); - Assert.Equal(0x2222UL, other.mine); + Assert.Null(failure); + Assert.Equal(0UL, seen); + Assert.Equal(0, setResult); + Assert.Equal(0x2222UL, mine); Assert.Equal(0x1111UL, Getspecific(context, key)); } }