Threading in Visual C++.NET

  • Thread starter Thread starter Filip
  • Start date Start date
F

Filip

Hi,

I was wondering if anyone can assist me in initating
some threading appliaction in VC.NET. I am trying to do
a server, and will need to spawn multiple ports to listen
on, but I can seem to find any decent sample on code that
will allow threading.

Any assistance will be greatly appreciated. Also, if
some general understanding can be given, as in how to
destroy the threads when needed, etc, that would really
help as well.

Thank You,

Filip
 
You don't destroy a thread, let it die on its own. This is the tricky part
for beginners. Read about "signals" and "events" in threads.

Use a vector/list to store pointers to the thread-structures. This way you
have an easy way to parse all thread structures if you have to do this in
your main thread. Don't destroy the main thread before all child threads
have died. A thread can only run once. If you want to run the same threads
multiple times, you have to call "new" on the objects for each restart.

Search amazon for a .net threading book. I don't have my books infront of me
(I'm on holiday with a laptop and a modem), but there are written many good
books on this.



Lars-Inge
http://www.larsigne.com
 
Back
Top