I am using a 'BackgroundWorker' object to impliment multithreadeding because it provides a really neat way of passing events into the main UI thread.
My problems occur when it is time to halt the background worker thread.
I can easily signal the thread to exit via synchronization objects and if desired I can service the 'RunWorkerCompleted' event later on but what I can NOT neatly do is wait for the thread to exit after I have signalled it to do so.
If this was a thread I had instantiated myself I could call its 'Join' method but I can find no equivalent for the BackgroundWorker - nor can I see anyway to get hold of its thread to call join on it myself.
I can bodge something up using synchronization objects so that the thread loop releases an object just before it exits and the terminating function 'Waits' on this object. But this approach causes problems during debug.
Is there any way to perform a 'Join' or some equivalent operation on a background worker thread.
Thanks in advance for any help or discussion on this subject.
Ted..