How to use thread in c++?

Started by
9 comments, last by yungivan 21 years, 7 months ago
quote:Original post by core
Multithreading is platform-dependent. _beginthread() and _beginthreadex() are not ANSI compatible. If you''re throwing compatibility out the window anyways, why not just use CreateThread() (other than not #include''ing windows.h)?


As already mentioned, you shouldn''t call CreateThread when using C/C++ runtime libraries. The __beginthreadex() function prepares the C/C++ runtime libraries for multithreading using TLS.

------

In order to successfully compile a source file with calls to __beginthreadex you must include AND make sure you are using multithreaded libraries (static or DLL.) Check your Project settings under the C++ tab, and under Code Generation.
[email=direwolf@digitalfiends.com]Dire Wolf[/email]
www.digitalfiends.com

This topic is closed to new replies.

Advertisement