Skip to content
Next Next commit
Handle NativeOverlapped* coming from both Portable and Windows thread…
… pool
  • Loading branch information
eduardo-vp authored and github-actions committed Mar 13, 2024
commit 6cf193a34d29b4d76ab21904f041d5363e5b1ba8
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,18 @@ public unsafe void ThreadPoolIOEnqueue(NativeOverlapped* nativeOverlapped)
{
if (IsEnabled(EventLevel.Verbose, Keywords.ThreadingKeyword | Keywords.ThreadTransferKeyword))
{
IntPtr hashCode;
if (ThreadPool.UseWindowsThreadPool) {
hashCode = (IntPtr)Win32ThreadPoolNativeOverlapped.FromNativeOverlapped(overlapped)->GetHashCode();
}
else
{
hashCode = (IntPtr)Overlapped.GetOverlappedFromNative(nativeOverlapped).GetHashCode();
}

ThreadPoolIOEnqueue(
(IntPtr)nativeOverlapped,
(IntPtr)Overlapped.GetOverlappedFromNative(nativeOverlapped).GetHashCode(),
hashCode,
false);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,18 @@ public unsafe void ThreadPoolIOEnqueue(NativeOverlapped* nativeOverlapped)
{
if (IsEnabled(EventLevel.Verbose, Keywords.ThreadingKeyword | Keywords.ThreadTransferKeyword))
{
IntPtr hashCode;
if (ThreadPool.UseWindowsThreadPool) {
hashCode = (IntPtr)Win32ThreadPoolNativeOverlapped.FromNativeOverlapped(overlapped)->GetHashCode();
}
else
{
hashCode = (IntPtr)Overlapped.GetOverlappedFromNative(nativeOverlapped).GetHashCode();
}

ThreadPoolIOEnqueue(
(IntPtr)nativeOverlapped,
(IntPtr)Overlapped.GetOverlappedFromNative(nativeOverlapped).GetHashCode(),
hashCode,
false);
}
}
Expand Down