Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

CreateThread for Windows 8 Metro

Sign in to follow this  


The WinRT programming environment, which is used to create Metro applications for Windows 8, replaces the old Win32 threading APIs such as CreateThread with a new ThreadPool::RunAsync API. This is generally a good thing (ThreadPool is better than CreateThread for several reasons) but it can be a pain when trying to port existing code that depends on those older APIs.
Porting shim to the rescue! This code emulates a subset of the Win32 threading APIs as a wrapper on top of WinRT ThreadPool:

  • CreateThread
  • CREATE_SUSPENDED and ResumeThread
  • Partial support for SetThreadPriority (see comments in the header for details)
  • Sleep
  • Thread local storage (TlsAlloc, TlsFree, TlsGetValue, TlsSetValue, plus see header comments about TlsShutdown)

    Get it here: ThreadEmulation.zip
    I recommend only using this for porting legacy code. When writing new Metro applications, it is better to directly use WinRT ThreadPool.aggbug.aspx?PostID=10281576

Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!