Skip to content

测试代码有崩溃,帮忙分析下原因~ #7

Description

@20083017

int64_t deadline = Clock::CurrentTimeMillis();
auto timer = CreateTimer(TimerSchedType::TIMER_HH_WHEEL);
std::vector times = {15,10,5,3,2,10,5,3,2,1,2,1,1,2000};
auto delay = 0;
std::cout << " start " << Clock::CurrentTimeMillis() << std::endl;
uint32_t duration = 0;
for (int i = 0; i < times.size(); i++) {

        duration += times[uint32_t(delay)%times.size()];
        std::cout << " duration " << duration << " cur ms: " << Clock::CurrentTimeMillis() << std::endl;
        int tid = timer->Start(duration, []() {

            std::cout << "client send 1111111        " << Clock::CurrentTimeMillis() << std::endl;


        });
        delay += 1;
    }
    for (int i = 0; i <= duration*2; i++) {
        timer->Update(Clock::CurrentTimeMillis());
        std::this_thread::sleep_for(std::chrono::nanoseconds(500 * 1000));
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions