locked
How to control timeout DownloadOperation::StartAsync ? RRS feed

  • Question

  • Hi,

    How i can control timeout of download operation?

    BackgroundDownloader^ bd = ref new BackgroundDownloader( ); DownloadOperation^ loader_op = bd->CreateDownload( address, file ); task< DownloadOperation^ > downloadTask( loader_op->StartAsync( ) ); downloadTask.then( [ = ]( DownloadOperation^ op ) { ... } );

     

    I don't see the way to pass cancellation_token to that API.

    • Edited by Vladbph Thursday, April 5, 2012 11:43 PM
    Thursday, April 5, 2012 11:41 PM

Answers

  • hi

    you can use

    WaitForSingleObjectEx(smi_event_wait,1000,false);
    it can sleep 1 second
    • Proposed as answer by Jesse Jiang Tuesday, April 17, 2012 7:35 AM
    • Marked as answer by Jesse Jiang Monday, May 7, 2012 2:54 AM
    Wednesday, April 11, 2012 9:36 AM

All replies

  • You can add a cancellation taken in the constructor, and keep watch the timeout on this taken.

    NEU_ShieldEdge

    Friday, April 6, 2012 7:05 AM
  • hi

    you can use

    WaitForSingleObjectEx(smi_event_wait,1000,false);
    it can sleep 1 second
    • Proposed as answer by Jesse Jiang Tuesday, April 17, 2012 7:35 AM
    • Marked as answer by Jesse Jiang Monday, May 7, 2012 2:54 AM
    Wednesday, April 11, 2012 9:36 AM