Giter Club home page Giter Club logo

Comments (3)

LittlePeng avatar LittlePeng commented on May 20, 2024

看设计是1ms 是为了检查 timeout用的。
其实可以这样:在 loop 前计算一下所有请求中的最小超时时间min_timeout ,epoll_wait 超时指定为 min_timeout 就能解决问题

from libco.

cauhn avatar cauhn commented on May 20, 2024

一般这个timeout值都是固定的,可以根据自身情况设置。
如果在loop前计算所有请求的最小超时时间,则需要查询Epoll_t->pTimeout里最小的timeout时间,这个时间复杂度是o(n) n=60*1000,这个还是不太划算的。

from libco.

yplusplus avatar yplusplus commented on May 20, 2024

比较折中的方案是检查Xms内有没有到期的定时器,有的话wait到最近到期的定时器;没有的话直接wait Xms

from libco.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.