-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Open
Description
See MonitorTests.InterruptWaitTest
under src/libraries/System.Threading/tests
(the test is being added by PR #87672):
runtime/src/libraries/System.Threading/tests/MonitorTests.cs
Lines 493 to 511 in ed64748
public static void InterruptWaitTest() | |
{ | |
object obj = new(); | |
lock (obj) | |
{ | |
var threadReady = new AutoResetEvent(false); | |
var t = | |
ThreadTestHelpers.CreateGuardedThread(out Action waitForThread, () => | |
{ | |
threadReady.Set(); | |
Assert.Throws<ThreadInterruptedException>(() => Monitor.Enter(obj)); | |
}); | |
t.IsBackground = true; | |
t.Start(); | |
threadReady.CheckedWait(); | |
t.Interrupt(); | |
waitForThread(); | |
} | |
} |
viktor-svub