I'm looking for a good simple step-by-step multi-threading tutorial.. I searched almost everywhere.. and almost in every place was a different style of multi-threading so I got really confused..
I'm looking for a good simple step-by-step multi-threading tutorial.. I searched almost everywhere.. and almost in every place was a different style of multi-threading so I got really confused..
what does signature stand for?
I highly recommend Programming Applications for Microsoft Windows (Dv-Mps General) by Jeffrey Richter.
Kuphryn
Well knowing something about your OS and Compiler would be a start.
As would some idea of what problem you intend to solve. Threads introduce a whole raft of new problems into your code, so you really need to be solving something pretty special just of offset those difficulties.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Some resources I've found helpful areI'm looking for a good simple step-by-step multi-threading tutorial.. I searched almost everywhere.. and almost in every place was a different style of multi-threading so I got really confused..
http://web.mit.edu/6.826/www/notes/HO16.pdf
http://www.flounder.com/mvp_tips.htm...esses%20series
Any book on operating systems should cover threads, too, and there also should be a book on pthreads if you check out your local library.
I'm using Windows XP (Home) and.. most of the time Dev-C++ .. latest release.. The problem I need to solve is sockets .. I read tutorials about multiple sockets.. it has some threading.. but I couldn't understand how it works..
what does signature stand for?
Oh.. and about my local library.. I'll barely find an old dirty fortran introduction book or maybe some basic
what does signature stand for?
> read tutorials about multiple sockets.. it has some threading
Perhaps you read the wrong tutorials then.
You can go one of two ways when dealing with multiple sockets.
1. Use a separate thread for each socket.
2. Use the select() call to tell you which socket(s) are active, and handle them appropriately.
A lot of people seem to choose 1. because it's quick and 'cool' (using threads, yeah baby!), without having a clue about the dangers ahead.
The argument against threads
http://www.kuro5hin.org/story/2002/11/18/22112/860
> but I couldn't understand how it works..
So why not put a specific post on the network forum then?
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
...
if ever a feature has been easy to compare to Goto in its destructiveness, threads would be that feature. Threads are, in a sense, "the goto that keeps on giving":
The rest of the paper will try to convince you that while there is a limited class of problems for which threads are a good solution, your problem is almost certainly not among them -- no matter what your problem is.
What Salem said seems more appropriate for a server. But if you want a gui client, then threads or processes are pretty much necessity. Your program could spend up to 10 seconds just waiting for the network connection to time out, and before it does time out your user won't be able to even close the application properly. Not good. Instead, I'd use threads, but I'd have to keep track of all the data structures and asynchronous messages the different threads use. At least in my case, the data is limited to two clases. Guarding this data is quite easy, and because each thread never has to lock two objects, dead lock cannot happen.
Last edited by okinrus; 06-18-2005 at 09:40 AM.
Umm, yeah, probably select() will work for this one, cause It's not over internet and stuff, just a LAN connection and connecting won't probably timeout and stuff.. I actually wanted to make a multi user poker card game anywayz.. what's a dead lock? and how do you guard your data when dealing with threads?
what does signature stand for?
Here is a basic tutorial in multithreading in Windows:
http://www.adrianxw.dk/SoftwareSite/.../Threads1.html
And there's MSDN:
Multithreading for Rookies
Synchronization
gg