Opened 11 years ago

#6679 new Feature Requests

[asio] request : repeat timer

Reported by: Akira Takahashi <faithandbrave@…> Owned by: chris_kohlhoff
Milestone: To Be Determined Component: asio
Version: Boost 1.49.0 Severity: Cosmetic
Keywords: Cc:

Description

This ticket is feature request. I want repeat feature in deadline_timer/waitable_timer. Many libraries timer have repeat features. follow code is example.

before:

void on_timer(error_code error, steady_timer& timer)
{
    if (error)
        return;

    timer.expires_from_now(seconds(1));
    timer.async_wait(boost::bind(&on_timer, _1, boost::ref(timer)));
}

int main()
{
    ...
    timer.expires_from_now(seconds(1));
    timer.async_wait(boost::bind(&on_timer, _1, boost::ref(timer)));
}

after:

void on_timer(error_code error, steady_timer& timer)
{
    if (error)
        return;

    // no boiler plate
}

int main()
{
    ...
    timer.expires_from_now(seconds(1), steady_timer::repeat);
    timer.async_wait(boost::bind(&on_timer, _1, boost::ref(timer)));
}

Change History (0)

Note: See TracTickets for help on using tickets.