Skip to content

Mono: Monitor.Enter() is not interrupted by Thread.Interrupt() #87718

Open
@kouvel

Description

@kouvel

See MonitorTests.InterruptWaitTest under src/libraries/System.Threading/tests (the test is being added by PR #87672):

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();
}
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions