This project is read-only.

create_timer_task

defined in header <pplpp.h>
inline concurrency::task<void> create_timer_task(std::chrono::milliseconds time,   
         concurrency::cancellation_token ct = concurrency::cancellation_token::none())

Summary

Creates a timer task that will complete after the input time.

Parameters

  • time: The timeout for the returning task.
  • ct: The cancellation token for cancelling timer.

Return values

The function returns a task that completes after the input time.

Sample

using namespace std::chrono;
system_clock::time_point startTime = system_clock::now();
concurrency::cancellation_token_source tcs;
auto t = pplpp::create_timer_task(seconds(1), tcs.get_token()).then([=] (concurrency::task<void> t) {
         auto timeDiff = duration_cast<milliseconds>(system_clock::now() - startTime).count();
         return pplpp::create_timer_task(seconds(1), tcs.get_token());
}).then([=] {});
tcs.cancel();

Last edited Jul 8, 2013 at 10:43 PM by gbb21, version 6

Comments

No comments yet.