Modify

Ticket #6679 (new Feature Requests)

Opened 5 years ago

[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

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as new
Author


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

 
Note: See TracTickets for help on using tickets.