M
Mark
I’ll try to explain my situation as clearly as possible… J
I have a UI form that fires a worker thread. The worker thread regularly
updates the UI via an Invoke (naturally). So far so good. The UI form also
has a button that can abort the thread. What I’m trying to achieve is for
the UI to say that the thread has been aborted once it has indeed been
aborted. Here’s my problem:
The user hits the Abort button which does an Abort() on the thread (after
interrupting a waitsleepjoin) and, as per the MSDN documentation then does a
join() to wait for the worker thread to finish (the documentation says that
I *must* join). The worker thread captures the abort signal and attempts to
update the UI via an Invoke. Of course, the main UI thread is now already
joined to the worker thread, so the invoked method called by the worker
thread sits in the UI thread queue and is unable to proceed because the UI
is waiting for the worker thread to abort. Result à deadlock.
I’m sure that there’s a “standard” way to resolve this presumably common
scenario, but I just can’t seem to track it down. Any ideas?
TIA
Mark
I have a UI form that fires a worker thread. The worker thread regularly
updates the UI via an Invoke (naturally). So far so good. The UI form also
has a button that can abort the thread. What I’m trying to achieve is for
the UI to say that the thread has been aborted once it has indeed been
aborted. Here’s my problem:
The user hits the Abort button which does an Abort() on the thread (after
interrupting a waitsleepjoin) and, as per the MSDN documentation then does a
join() to wait for the worker thread to finish (the documentation says that
I *must* join). The worker thread captures the abort signal and attempts to
update the UI via an Invoke. Of course, the main UI thread is now already
joined to the worker thread, so the invoked method called by the worker
thread sits in the UI thread queue and is unable to proceed because the UI
is waiting for the worker thread to abort. Result à deadlock.
I’m sure that there’s a “standard” way to resolve this presumably common
scenario, but I just can’t seem to track it down. Any ideas?
TIA
Mark