News for hackers. Stuff that matters.
Re:C++20 has been approved by vips7L on Sunday September 06, 2020 @09:31AM (#24391165)
And now Java is benifiting from being a second mover on a lot of the features C# adopted.

See virtual threads vs async/await. Java's version is going to be better.

Re:C++20 has been approved by pjmlp on Sunday September 06, 2020 @11:22AM (#24391971)
I always end up with a couple of Task.Run() calls, because cannot change the complete call chain to deal with async/await.
Re:C++20 has been approved by Const-me on Monday September 07, 2020 @08:24AM (#24398931)
If you want to avoid changing the complete chain to Task, there’re workarounds.

You can block the caller thread waiting for the task. Deadlocks are possible with this approach due to synchronization context shenanigans, but they’re easy to fix, VS debugger is quite good at multithreading.

Another method, you can run whatever dispatcher on your main thread, in modern .NET that’s usually Dispatcher.PushFrame.

Also, if the async method returns no values, you don’t need to change the call chain, you just need to catch and handle exceptions.

Re:C++20 has been approved by fomine3 on Monday September 07, 2020 @04:01AM (#24397530)
Even that situation, you can still use await inside Task.Run, it should be useful than nothing.