first_page the funky knowledge base
personal notes from way, _way_ back and maybe today

Flippant Remarks about Canceling BackgroundWorker Operations

In “Creating a better BackgroundWorker: CancelImmediately and other goodies,” Roy Osherove introduces my problem, “Right now BackgroundWorker has only one way to cancel: "CancelAsync()". The feature I was missing was "CancelImmediately()". I've even gotten to talk a little with Mark Rideout, Program Manager for the .NET Client who supported my claim that this is not possible with the current version of BackgroundWorker.”

What this means is that one of the design goals behind BackgroundWorker cancellation is to stop a background process that performs the same, ‘small’ operation that runs and returns to a loop. It follows that the problem of canceling one ‘big’ operation is not really solved by BackgroundWorker. This is because once the BackgroundWorker process runs it really cannot be stopped until it returns. I find this very counterintuitive.

The Roy Osherove article is here:

http://weblogs.asp.net/rosherove/pages/BackgroundWorkerEx.aspx
mod date: 2007-10-01T22:42:54.000Z