Threading

D

Doug

Hi,

I am looking to write my first application that will use threading. I
understand the concept but am not that familiar with the details of how
to make this work in code. Does anyone have any suggestions on some
good books out there that talk about this topic? Issues that I'm
looking at are how to make sure I am actually able to start seperate
threads that will run concurrently and ensuring the best way to handle
when/if a thread aborts (without affecting other threads).
 
B

Ben Voigt

Doug said:
Hi,

I am looking to write my first application that will use threading. I
understand the concept but am not that familiar with the details of how
to make this work in code. Does anyone have any suggestions on some
good books out there that talk about this topic? Issues that I'm
looking at are how to make sure I am actually able to start seperate
threads that will run concurrently and ensuring the best way to handle
when/if a thread aborts (without affecting other threads).

The best way is:
Don't let a thread abort. Use a top-level try-catch block in your thread
procedure, don't ever call Thread.Abort, and avoid stack overflows.

When you have an error condition, you can throw an exception to notify the
caller, but the thread procedure should always catch this, deallocate any
remaining resources, and exit cleanly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top