Skip to content

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

@szmcdull

Description

@szmcdull

[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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions