Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

7
  • 6
    "At runtime, to convert an async call to a synchronous one is trivial" I'm not sure it is exactly so. In .NET, using .Wait() method and like can cause negative consequences, and in js, as far as I know, it is not possible at all. Commented Dec 5, 2018 at 10:00
  • 2
    @max630 I didn't say there aren't concurrent issues to consider, but if it was initially a synchronous task, chances are it's not creating deadlocks. That said, trivial does not mean "double click here to convert to synchronous". In js, you return a Promise instance, and call resolve on it. Commented Dec 5, 2018 at 10:25
  • 2
    yeah its totally a pain in the arse to convert async back to sync Commented Dec 5, 2018 at 10:26
  • 4
    @Neil In javascript, even if you call Promise.resolve(x) and then add callbacks to it, those callbacks won't be executed immediately. Commented Dec 5, 2018 at 16:54
  • 1
    @Neil if an interface exposes an asynchronous method, expecting that waiting on the Task won't create a deadlock isn't a good assumption. It's much better for the interface to show it is actually synchronous in the method signature, than a promise in the documentation that could change in a later version. Commented Dec 6, 2018 at 20:49