StephenCleary / AsyncEx

A helper library for async/await.
MIT License
3.53k stars 356 forks source link

AsyncMRE calls Set continuations on BG thread #44

Closed Belorus closed 8 years ago

Belorus commented 8 years ago

Does it need ?

_tcs.TrySetResultWithBackgroundContinuations();

It can be expensive to call it frequently

StephenCleary commented 8 years ago

Yes, this is required because it is called from within a lock.

.NET 4.6 introduced a flag that makes this unnecessary (if you specify the flag), and I use this newer approach in the .NET 4.6 / .NET Core rewrite of AsyncEx.

IanYates commented 8 years ago

Hi @StephenCleary - I wasn't aware of this new flag so I've gone and done some reading. One thing that I came across was https://support.microsoft.com/en-us/kb/3118695 I guess that's going to make the .NET 4.6.1 version possibly tricky.

Anyway, I figured that since this topic brought the flag to my attention in the first place it was probably a good place to mention this known bug in the framework.

StephenCleary commented 8 years ago

Thank you for pointing that out! I was not aware of this bug. :/