Git Product home page Git Product logo

Comments (6)

0x804d8000 avatar 0x804d8000 commented on May 3, 2024 1

确实写错了,感谢反馈,我处理下。

本意是避免多个fiber同时调用用户的callback,不然容易导致线程安全问题。因为一般除非极端情况下timer运行的特别慢,不然不会导致多个timer同时跑,所以对用户来说大多数情况下在timer里面加锁也没太大意义。

UserCallback的另外一个目的是为了在下面套上shared_ptr,提供CopyConstructible,不然没法多次StartFiberDetached。(不过单纯就这一点来说其实shared_ptr<function>也是一样的)

from flare.

4kangjc avatar 4kangjc commented on May 3, 2024 1

timer可以把文档补全一下,或者我来也行,我想想怎么写

from flare.

4kangjc avatar 4kangjc commented on May 3, 2024 1

timer可以把文档补全一下,或者我来也行,我想想怎么写

有时间再写, 不定时:)

from flare.

4kangjc avatar 4kangjc commented on May 3, 2024 1

README中的[调度组](flare/), 这里文档没有链接上

from flare.

4kangjc avatar 4kangjc commented on May 3, 2024

确实写错了,感谢反馈,我处理下。

本意是避免多个fiber同时调用用户的callback,不然容易导致线程安全问题。因为一般除非极端情况下timer运行的特别慢,不然不会导致多个timer同时跑,所以对用户来说大多数情况下在timer里面加锁也没太大意义。

UserCallback的另外一个目的是为了在下面套上shared_ptr,提供CopyConstructible,不然没法多次StartFiberDetached。(不过单纯就这一点来说其实shared_ptr<function>也是一样的)

是不是要把if换成while, 多个fiber同时调用用户的callback, 就只执行其中的一个吗?

from flare.

0x804d8000 avatar 0x804d8000 commented on May 3, 2024

本来的想法是采取一个跟Windows类似的做法,避免因为timer处理不过来导致一直在跑个不停

不过现在想想这个做法可能确实容易给用户一些非预期的结果,而且很难定位到问题出在这里,可能确实while (remining--)更合适些

from flare.

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.