Does V8 have an event loop?

谁说我不能喝 提交于 2019-12-18 16:53:45

问题


I keep hearing V8 has its rudimentary event loop implementation but

  1. couldn't find it
  2. doesn't really make sense to me. Methinks, the simplest design of a JS engine would be to simply run synchronously and let the "embedder" write their own event loop - like nodejs got libuv.

Is there an event loop implementation in v8? If so, could you point me at it?


回答1:


Your intuition is right that the event loop is something that embedders should have control over. However, it is also a fundamental abstract concept of the JavaScript programming model. V8's solution is to provide a default implementation that embedders can override; you can find it in the "libplatform" component: https://chromium.googlesource.com/v8/v8/+/master/src/libplatform/default-platform.cc#140

See also Relationship between event loop,libuv and v8 engine



来源:https://stackoverflow.com/questions/50115031/does-v8-have-an-event-loop

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!