3 ms·
As a matter of fact, you can do the same in assembly if you want to. Notice how you can always have that answer when it comes to programming languages: you can
by quadcore 9y ago
As a matter of fact, you can do the same in assembly if you want to.
Notice how you can always have that answer when it comes to programming languages: you can do the same in. The point is that, the way it's made in go, is awfully handy.
- pjmlp 9y agoI hardly see a difference from go func () { } and Task.Run(() => { }) With the benefit that on the latter example, the runtime allows me to customise how scheduling is done.
- quadcore 9y agoAre those Tasks coroutines? If yes, do they yield on any sleeps? These aspects are key to goroutines.
- pjmlp 9y agoYes they do, they are the building blocks for async/await, get a thread allocated from a thread pool when running, and you can control how the scheduling takes place, by providing your own scheduler implementation.
- ta2384428 9y agoThat is pretty cool, C++ has come a long way since I used it last about 15 years ago. It seems like both languages are equally capable here, with C++ having more power and foot guns when required as usual.
- pjmlp 9y agoThe code snippet example I wrote was actually .NET with TPL. C++ with PPL on Windows, would be task<T> handle = create_task([] { /* ... */ }); And with standard C++ future<T> handle = std::async(std::launch::async, [] { /* ... */ }); In both cases, with C++20 it will be possible to co_await handle, which you can already play with on clang and VC++.