Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can we create a thread in C++?
Posted
Updated 23-Dec-11 0:16am
v2

Thread libraries are platform dependent (*), for instance on Windows you typically use CreateThread function[^] while on Linux you would use POSIX threads' pthread_create function[^].


If you need portability then have a look at Boost.Threads[^].
 
Share this answer
 
v2
Comments
Albert Holguin 23-Dec-11 6:02am    
Pretty much covers it, most frameworks have their own thread implementation (obviously, cross-platform frameworks simply implement the different system APIs since it's not part of standard C++), +5
CPallini 23-Dec-11 6:14am    
Thank you.
BrainlessLabs.com 23-Dec-11 9:54am    
My 5 too.
I think in Windows using _beginthreadex is better option. Please refer this.

http://msdn.microsoft.com/en-us/library/kdzttdcb(v=vs.80).aspx[^]
 
Share this answer
 
 
Share this answer
 
There are lots off "cross platform" " C++" libraries, but boost is the best one.
It is free and since you decided to using threads, you would also need thread synchronization, boost will help you for the same.
 
Share this answer
 
This is how it should be implemented by the standard: C++11 FAQ. Threads.[^].
And it is already available in VC11, according to Microsoft Connect[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900