I am new to thread programming,i basically want to learn how write threads in c++.It would be a great help to me if anyone could guide me through this or provide any tutorial links.


thanks in advance
sidharth

Recommended Answers

All 5 Replies

The current C++ standard does not support threads, so you will either have to pick a nonstandard implementation or wait until the new standard is complete.

Have a look here.

The current C++ standard does not support threads, so you will either have to pick a nonstandard implementation or wait until the new standard is complete.

Ya C++0x specification does support threads.
There are google tech video that illustrating how to work with C++0x threads.Find it out.

Let us know your development environment then we can help.In linux use pthread library.
pthread means POSIX (portable operating system interface).POSIX is simple and small.
why I like POSIX very much.
https://computing.llnl.gov/tutorials/pthreads/

if you are new to the linux then before read http://www.advancedlinuxprogramming.com/alp-folder/alp-ch04-threads.pdf read the first chapters too.

As Duki suggested, use the Boost Thread library. You will have to install boost. This library in cross-platform and quite easy to use, and includes all the synchronization objects you can dream of. The C++0x standard will include a thread library, and that thread library will be directly taken from the Boost Thread library (Boost is the anti-chamber for the C++ standard libraries). So I would suggest you get acquainted with that library since, once the standard is out, it will be mostly the same (maybe only a subset of the Boost one), only the namespace will change from boost:: to std::.

Thanks a lot for your help. i am using Dev-C++ as my IDE

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.