Skip to main content
5 events
when toggle format what by license comment
Dec 7, 2018 at 2:17 comment added Miral (And by this I of course mean a blocking sync method. You can call something that makes a pure CPU-bound calculation synchronously from an async method -- although you should try to avoid doing it unless you know you're in a worker context rather than a UI context -- but blocking calls that wait idle on a lock or for I/O or for another operation are a bad idea.)
Dec 7, 2018 at 2:13 comment added Miral It's the other way around; it's trivial to call an async method from a sync method, but it's impossible to call a sync method from an async method. (And where things completely fall apart is when someone tries to do the latter anyway, which can lead to deadlocks.) So if you had to pick one, async by default is the better choice. Unfortunately it's also the harder choice, because an async implementation can only call async methods.
Dec 7, 2018 at 2:13 comment added Miral @AdrianWragg So I did; my brain must have had a race condition. I'll fix it.
Dec 6, 2018 at 11:37 comment added Adrian Wragg @Miral You've used "call an async method from a sync method" in both possibilities.
Dec 5, 2018 at 15:44 history answered Walfrat CC BY-SA 4.0