How can I access CancellationPending for this thread beyond the BackgroundWorker class?
<p>I have a Windows service that creates a number of BackgroundWorkers. The DoWork handler of these BackgroundWorkers just contains SomeObject.DoSomeWork() and the method (i.e. DoSomeWork) does not take any reference to the BackgroundWorker. The blocking work happens many layers deeper. In the method with the blocking work I want to add logic to test CancellationPending of the owning BackgroundWorker. How???</p>

<p>I don't want to refactor all the classes to pass a reference to the BackgroundWorker, I want to be able to write something like this;</p>

<pre><code>(BackgroundWorker(Thread.CurrentThread)).CancellationPending
</code></pre>

<p>But this obviously doesn't work because BackgroundWorker is not a thread itself.</p>

<p>I haven't tried anything because I haven't thought of anything to try. I've Googled a lot and read a lot but not found anything to point me in the right direction. It might be the case that it's not possible (at least not possible without getting too hacky) in which case I'll have to think of a different approach to the problem, but I need someone cleverer than me to tell me it's not possible :)</p>