Hi,
My application needs a separate thread for doing some data processing. This is a very long running task (I'd probably need it to run for as long as the application itself runs).
What is the recommended / best-practice method for creating such a long-running task? It looks like the classic threading functions (CreateThread et al.) are no longer available.
I tried using something like this:
backgroundWorker = concurrency::create_async([this](concurrency::cancellation_token ct) {
while (!ct.is_canceled())
{
DoProcessingStep();
}
concurrency::cancel_current_task();
});
It seems to work, but I noticed my CPU is pegged (one of the cores sits at 20 - 30% all the time), while with the same code in a classic Win32 application, it barely budged. The processing itself is not expensive (audio playback from a network stream). Any
suggestions?
Thanks!