Starting a thread, maintaining it are easy enough. And as long as you have a reference to the thread, it is easy to wait for it. However, this problem that I have just run into really sucks.
I have a web application where the visitor enters information into a search form, and then they are immediately forwarded to an advertisement while the search takes place in the background (hence the thread). This thread does a bunch of stuff. In fact, too much to mention...
Well, I had this all working on my dual core notebook. It was great! With one exception, it worked flawlessly.
As with any application, there comes a time to where it needs to be tested in a psuedo-production environment, and this is the time that I am about to speak of.
I moved this piece of the web application to our test site. I didn't expect anything to go wrong with the thread itself, but rather workflow logic. Well, things nearly never work like we expect, do they?
For some reason, the thread dies somewhere in the process, and I cannot figure out why. This only happens on the server. Argh!
Okay - I am done venting...