locked
How to cancel a sync session? RRS feed

  • Question

  • I'm running a sync session in a background thread uing two simple sync providers. How do I cancel the sync session in the middle? I know SyncOrchestrator class has a Cancel() methd but as far as I know its Synchronize() method is a blocking call, so the thread is busy with the Syncrhonization() method.
    Tuesday, May 18, 2010 11:04 PM

Answers

  • Hi,

    If your main thread has a reference to the SyncOrchestrator, you can call its Cancel method. Although Synchronize() in the background thread is a blocking call, it checks the cancel state at special points. When it finds that Cancel state is set, it will stop the sync and start cancellation process.

    Another way is to call the SyncOrchestrator.Cancel in a sync event callback method based on your custom conditions. Similiar internal logic will handle the Cancel state too.

    Thanks,
    Dong


    This posting is provided AS IS with no warranties, and confers no rights.
    Tuesday, May 18, 2010 11:40 PM