Thread.Abort() creates deadlock when worker thread calls Dispatcher.Invoke()
Two threads: main (GUI) and worker. The worker asks the main to update
using Dispatcher.Invoke(...). At some point, as a result of user
intervention, I must abort the worker using Thread1.Abort(). But a
deadlock seems to be created in this sequence:
T1 invokes for an action
main-thread aborts T1
I know, Aborting is evil (what should I do ? insert CheckIfCanceled()
every two lines ??), but assuming it's necessary - how can I prevent the
deadlock ?
No comments:
Post a Comment