This project is read-only.

timed_cancellation_token_source class

defined in header <pplpp.h>
class timed_cancellation_token_source

Summary

A cancellationtokensource with delayed cancelation feature.

The “cancel” method has an overload that will cancel the cancellation_token_source after a delay.

Public Methods:

Name: Description
void cancel() Cancel the cancellation_token_source and all tokens associated with it
void cancel(std::chrono::milliseconds delay) Cancel the “cancellation_token_source ” after the given "delay" time.
concurrency::cancellation_token_source get_token() const Returns the cancellation_token associated with this source.

Sample

pplpp::timed_cancellation_token_source tcs1;
auto t = pplpp::create_timer_task(seconds(1), tcs1.get_token()).then([=](concurrency::task<void> t) {
     auto timeDiff = duration_cast<milliseconds>(system_clock::now()- startTime).count();
     
});
tcs1.cancel(milliseconds(100));

Last edited Jul 8, 2013 at 10:44 PM by gbb21, version 7

Comments

No comments yet.