How should I check for a CancellationPending within a BackgroundWorker DoWork method, when within this method I call off to a Pcap.Net packet capture routine, which responses via a callback. The two options I can think of is:

a) write a loop at the bottom of the DoWork method to continually check for CancellationPending

b) put the check in the callback method I wrote which Pcap.Net will call back into - but no doubt the potential issue here is the cancellation can't work then until another patch match occurs and there is a callback

suggestions?

```
public class MainClass {
       private void bgWorker_DoWork(object sender, DoWorkEventArgs e)
       {
            var worker = sender as BackgroundWorker;
            _packetCapturer = new PacketCapturer();
        }

}

    public class PacketCapturer

      public PacketCapturer() {
         // Start Capture Here
         // Opens PacketCommunicator
         // communicator.ReceivePackets(0, PacketCapturerCallback);

      }

      private static void PacketCapturerCallback(Packet packet) {
         // Deal with returned packet

      }

    }

```