Can someone tell a very good C++ Thread Tutorial.
Can someone tell a very good and easy to understand Thread Tutorial in C++ (Not VC++).
I am making a Client Server application(posted other difficulties regarding the same in this forum) and want to make use of threads extensively. There are 11 Servers in my application which works simultaneously and the client connects to all of them simultaneously, thus a lot of thread programming is required. Also I have to connect one Server to all of the remaining Servers, and continue this process for all servers. So again a lot of thread programming is required here also.
That is, I have to make a highly Multithreaded Client-Server application.
Language Used : C++
Platform : Windows
IDE : Using VC++ 2005
Waiting for reply...
Pawan
# 1 Re: Can someone tell a very good C++ Thread Tutorial.
The problem is that standard C++ has no threading library so you must use one of the widely-used libraries. On Windows, this would be the Win32 API or POSIX threads (pthreads). You can also download the Boost thread library which is pretty portable but not as good as a native library.
Danny at 2007-11-11 20:59:05 >

# 2 Re: Can someone tell a very good C++ Thread Tutorial.
Can you tell me more specifically which one is more easy to learn and use : Windows API Threads or POSIX Threads. Also which will be better with respect to my application.
Pawan
# 3 Re: Can someone tell a very good C++ Thread Tutorial.
Hi,
The real question is not, which library is better for your purpose. There will be little difference in terms of complexity/suitability. Far more important in the case of threads is the design of your software.
How are you synchronising threads?
Avoid race conditions?
Deadlocks?
How are you exchanging data between threads?
It's pretty easy to spawn threads (e.g. a call to AfxBeginThread(...) in Windows will do the trick), but avoiding the above problems is far more difficult. Here is where good design comes into play. Once you are clear about that, the rest is implemetation...
Cheers,
D
# 4 Re: Can someone tell a very good C++ Thread Tutorial.
Thanks you, I will study Win API Threads. But again can you help....
Can you provide me with links to some Windows API Thread tutorials.
Or links to some books for the same.
Pawan
# 6 Re: Can someone tell a very good C++ Thread Tutorial.
the windows' afxbeginthread / etc functions are extremely simple to use, and flexible enough for most programs.
jonnin at 2007-11-11 21:04:03 >
