Threading best practices in WinRT RRS feed

  • Question

  • 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())
    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?


    Thursday, May 31, 2012 9:51 PM