What is the replacement of SetThreadPriority and GetThreadPriority for windows RT?


  • I am porting a windows desktop app to metro style app.

    My desktop app uses the following system API functions:



    Both the functions are declared in processthreadsapi.h for windows desktop app.These functions  are not compatible for metro style app.

    Is there any replacement of these functions for metro style app?
    Monday, September 3, 2012 12:16 PM


All replies

  • I am not aware of direct replacements for these, but I have not researched this to know for sure. generally the MSDN docs are complete regarding what is available for Windows 8 Store apps vs Desktop apps.

    What are you trying to achieve by changing the thread priority? perhaps this can be accomplished some other way.

    in general changing thread priority can be dangerous; impacting the behavior of the system in ways that are untested. it can also lead to priority inversion.


    Monday, September 3, 2012 9:07 PM
  • Hello,

    There is WorkItemPriority in Windows::System::Treading, which you can use it create thread pool in Win8 Style app.

    Please check this document
    How to create a periodic work item
    And this Thread pool sample

    Best regards,

    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, September 4, 2012 8:48 AM
  • Hi  Jesse,

    I also have the same problem. I am porting my Desktop app to metro. As I would not like to use thread pool and want to use _beginthreadex instead for creating new worker thread, so i need the equivalent of SetThreadPriority/GetThreadPriority.

    Wednesday, September 5, 2012 1:04 PM
  • That API is not permitted. See this list:

    Windows Runtime Unsupported CRT Functions

    David Lamb

    • Proposed as answer by Jesse Jiang Thursday, September 6, 2012 5:46 AM
    • Marked as answer by Jesse Jiang Monday, September 24, 2012 8:50 AM
    Wednesday, September 5, 2012 3:07 PM
  • I am aware about  Windows::System::Threading.

    I am porting a current desktop app to metro style.If i go for WorkItemPriority in Windows::System::Threading i have to do a lot of modification in my existing code.If i go for  Windows::System::Threading ,i will surely miss my deadlines. 

    Thats why i am looking for the exact replacement of



    so that i can complete my project earlier.

    Friday, September 7, 2012 3:43 AM
  • Fahad,

    _beginthreadex is desktop family library and it is deprecated in Windows store apps.

    In Windows 8 Release Preview (build 8400), unfortunately _beginthreadex go out of #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP conditions. That's why you can use it. In  Windows 8 RTM this problem is resolved and _beginthreadex & its co are no longer available.

    So there is no chance to use SetThreadPriority/GetThreadPriority, you have to use threadpool  and WorkItemPriority instead it

    • Marked as answer by Jesse Jiang Monday, September 24, 2012 8:50 AM
    Monday, September 17, 2012 1:14 PM