You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the code uses an overload of Task.Factory.StartNew that captures the TaskScheduler on which the constructor is executed. This immediately results in deadlock in single-threaded schedulers as the reader is blocking. Task.Run should be used instead (situation described in https://blog.stephencleary.com/2013/08/startnew-is-dangerous.html)
If leaving TaskCreationOptions.LongRunning is desired, then we must keep StartNew and specify the default task scheduler. This might be reasonable in library code, as we have to be more careful with the user's thread pool.
The text was updated successfully, but these errors were encountered:
Currently the code uses an overload of
Task.Factory.StartNew
that captures the TaskScheduler on which the constructor is executed. This immediately results in deadlock in single-threaded schedulers as the reader is blocking. Task.Run should be used instead (situation described in https://blog.stephencleary.com/2013/08/startnew-is-dangerous.html)If leaving TaskCreationOptions.LongRunning is desired, then we must keep StartNew and specify the default task scheduler. This might be reasonable in library code, as we have to be more careful with the user's thread pool.
The text was updated successfully, but these errors were encountered: