Skip to content
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

In GetOrAddAsync replace Thread.Yield by await Task.Delay(1)? #197

Open
szmcdull opened this issue Aug 20, 2024 · 0 comments
Open

In GetOrAddAsync replace Thread.Yield by await Task.Delay(1)? #197

szmcdull opened this issue Aug 20, 2024 · 0 comments

Comments

@szmcdull
Copy link

[Use the Thumbs Up reaction to vote for this feature, and please avoid adding comments like "+1" as they create noise for others watching the issue.]

Is your feature request related to a problem? Please describe.
Thread.Yield in a loop will lock down the whole thread, so no other async routines can run on the trhead. This may lead to problems where many async routines are running or being created.

Describe the solution you'd like
Simply replace Thread.Yield by await Task.Delay(1) or something alike.

Additional context
I'm specifically concern because I'm using a single-threaded async model. Locking the thread will dead lock.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant