liptonIcedTea
Well-known member
- Joined
- Jan 18, 2007
- Messages
- 89
- Programming Experience
- 1-3
Hi,
I'm using Backgroundworker to start a thread which goes off and generates a report using some complex calculations.
These reports can take a long time to generate (over an hour at times) and I would like the ability to cancel the report if I wished.
Backgroundworker offers a CancelAsync method. This sets a property inside Backgroundworker, and it is up to you to programmatically stop the thread inside your doWork method.
Now I do not understand why Microsoft has implemented like this... because although this works only if the bulk of your calculations go around a loop. If however, the bulk of my calculations is inside a method in which you have no access to, CancelASync is useless.
Is there a way to destroy a Backgroundworker thread immediately? I have tried Dispose(), that does not seem to work.
Thank you
I'm using Backgroundworker to start a thread which goes off and generates a report using some complex calculations.
These reports can take a long time to generate (over an hour at times) and I would like the ability to cancel the report if I wished.
Backgroundworker offers a CancelAsync method. This sets a property inside Backgroundworker, and it is up to you to programmatically stop the thread inside your doWork method.
Now I do not understand why Microsoft has implemented like this... because although this works only if the bulk of your calculations go around a loop. If however, the bulk of my calculations is inside a method in which you have no access to, CancelASync is useless.
Is there a way to destroy a Backgroundworker thread immediately? I have tried Dispose(), that does not seem to work.
Thank you