Re:Why has CPU frequency ceased to grow? (2014)
by pjmlp on Thursday February 22, 2018 @03:43AM
(#16436175)
Yes 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.
[ Parent
| on HN ]
Re:Why has CPU frequency ceased to grow? (2014)
by ta2384428 on Thursday February 22, 2018 @08:54AM
(#16437520)
That 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.
Re:Why has CPU frequency ceased to grow? (2014)
by pjmlp on Thursday February 22, 2018 @01:25PM
(#16439937)
The 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++.