Skip to content

Don't invoke continuations inline in OnCompleted #12261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 17, 2019

Conversation

halter73
Copy link
Member

@halter73 halter73 commented Jul 17, 2019

This should be impossible for LibuvAwaitable anyway since both OnCompleted and its Callback property are always invoked from the same thread.

@halter73 halter73 force-pushed the halter73/taskrun-oncompleted-continuations branch from c2e7b11 to fee23ca Compare July 17, 2019 01:02
@davidfowl
Copy link
Member

The Linuv one seems unnecessary. And if it happens we should queue to the uv thread

@halter73
Copy link
Member Author

The Linuv one seems unnecessary. And if it happens we should queue to the uv thread

Good catch. If the next call to FromApplicationPipeReader.ReadAsync in LibuvOutputConsumer.WriteOutputAsync returned a completed ValueTask, we could end up calling uv_write on a random threadpool thread.

I don't have a reference to the LibuvThread in LibuvAwaitable. I could plumb it through, or I could just do a Debug.Assert(false) or something and not call the continuation at all.

@halter73 halter73 force-pushed the halter73/taskrun-oncompleted-continuations branch from ead7f5e to a65f06b Compare July 17, 2019 01:58
@halter73
Copy link
Member Author

I did the Debug.Assert thing and got rid of the Interlocked.CompareExchange in LibuvAwaitable since everything is called from the same thread anyway.

@halter73 halter73 force-pushed the halter73/taskrun-oncompleted-continuations branch from a65f06b to 8a7334e Compare July 17, 2019 02:00
@halter73 halter73 merged commit fb12909 into master Jul 17, 2019
@ghost ghost deleted the halter73/taskrun-oncompleted-continuations branch July 17, 2019 05:14
@analogrelay analogrelay added this to the 3.0.0-preview8 milestone Jul 19, 2019
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants