Modify

Opened 5 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)));
}

Attachments (0)

Change History (0)

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain chris_kohlhoff.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.