Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Expose\test generic UnsafeQueueUserWorkItem overload #33637

Merged
merged 2 commits into from
Nov 27, 2018

Conversation

stephentoub
Copy link
Member

else
{
ThreadPool.QueueUserWorkItem(s => s.SetResult(asyncLocal.Value), tcs, preferLocal);
}
asyncLocal.Value = 0;
Copy link
Member

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

Copy link
Member

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.

Copy link
Member Author

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.

@stephentoub
Copy link
Member Author

@dotnet-bot test this please

@benaadams
Copy link
Member

benaadams commented Nov 23, 2018

@dotnet-bot test UWP NETNative x86 Release Build

@benaadams
Copy link
Member

@dotnet-bot test Packaging All Configurations x64 Debug Build please

@stephentoub
Copy link
Member Author

@benaadams, the underlying coreclr change hasn't mirrored to corert yet.

@benaadams
Copy link
Member

Thought @jkotas did it manually? dotnet/corert#6599

@stephentoub
Copy link
Member Author

stephentoub commented Nov 23, 2018

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.

@stephentoub
Copy link
Member Author

Though that was actually my bad; that file wouldn't have been mirrored anyway, as it's not shared. Thanks, @jkotas.

@jkotas
Copy link
Member

jkotas commented Nov 23, 2018

It would not automatically mirror anyway since the change was in a file that is not shared yet.

@benaadams
Copy link
Member

Not bubbled through yet though

error : MembersMustExist :
 Member 'System.Threading.ThreadPool.UnsafeQueueUserWorkItem<TState>(System.Action<TState>, TState, System.Boolean)'
 does not exist in the implementation but it does exist in the contract.

@stephentoub stephentoub merged commit a3cef9c into dotnet:master Nov 27, 2018
@stephentoub stephentoub deleted the uquwi branch November 27, 2018 19:55
jlennox pushed a commit to jlennox/corefx that referenced this pull request Dec 16, 2018
* Expose\test generic UnsafeQueueUserWorkItem overload

* Suppress ApiCompat warning
@karelz karelz added this to the 3.0 milestone Dec 21, 2018
baulig pushed a commit to mono/corefx that referenced this pull request Feb 5, 2019
* Expose\test generic UnsafeQueueUserWorkItem overload

* Suppress ApiCompat warning

(cherry picked from commit a3cef9c)
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
…3637)

* Expose\test generic UnsafeQueueUserWorkItem overload

* Suppress ApiCompat warning


Commit migrated from dotnet/corefx@a3cef9c
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
6 participants