-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Expose\test generic UnsafeQueueUserWorkItem overload #33637
Conversation
else | ||
{ | ||
ThreadPool.QueueUserWorkItem(s => s.SetResult(asyncLocal.Value), tcs, preferLocal); | ||
} | ||
asyncLocal.Value = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
asyncLocal.Value = 0; [](start = 12, length = 21)
Is it possible the queued work item can finish executing before executing this line? if so the following check can fail at that time in case of useunsafe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My guess is that the unsafe version would run in the default execution context, where the AsyncLocal would not exist, defaulting to a value of 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. There should not be a race condition here.
@dotnet-bot test this please |
@dotnet-bot test UWP NETNative x86 Release Build |
@dotnet-bot test Packaging All Configurations x64 Debug Build please |
@benaadams, the underlying coreclr change hasn't mirrored to corert yet. |
Thought @jkotas did it manually? dotnet/corert#6599 |
Ah, I didn't see he did that, just knew the mirror was down. Thanks. Though that's insufficient on its own unless it's resulted in a new ProjectNtfs build that's then been consumed into corefx, and I don't believe that's happened. |
Though that was actually my bad; that file wouldn't have been mirrored anyway, as it's not shared. Thanks, @jkotas. |
It would not automatically mirror anyway since the change was in a file that is not shared yet. |
Not bubbled through yet though
|
* Expose\test generic UnsafeQueueUserWorkItem overload * Suppress ApiCompat warning
* Expose\test generic UnsafeQueueUserWorkItem overload * Suppress ApiCompat warning (cherry picked from commit a3cef9c)
…3637) * Expose\test generic UnsafeQueueUserWorkItem overload * Suppress ApiCompat warning Commit migrated from dotnet/corefx@a3cef9c
Depends on dotnet/coreclr#21125
Fixes https://github.com/dotnet/corefx/issues/32547
cc: @kouvel, @tarekgh