Skip to content

[NativeAOT] Thread.Interrupt not implemented on Windows #118293

@jkotas

Description

@jkotas

See https://github.com/dotnet/runtime/blob/main/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Thread.NativeAot.Windows.cs#L389

  • The implementation should use QueueUserAPC Windows API. The callback passed to the QueueUserAPC should be a method implemented in native C/C++ code to make sure that there are not issues with managed code reentrancy.
  • The callback should set a thread local flags that gets checked when inside Wait, Thread.Sleep or Thread.Join operations when the Windows API returns WAIT_IO_COMPLETION
  • Thread.Sleep on Windows should be changed to use alertable wait
  • Thread.Interrupt for thread that has not been started yet should queue a pending interrupt that will trigger first time the thread waits.
  • Thread.Interrupt for dead thread should do nothing.
  • Delete all ActiveIssue attributes that disable Thread.Interrupt tests on NativeAOT in src\libraries\System.Threading.Thread\tests\ThreadTests.cs, src\libraries\System.Threading\tests\MonitorTests.cs and src\tests\baseservices\threading\regressions\115178\115178.cs

Metadata

Metadata

Assignees

Type

No type

Projects

Status

No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions