消息队列和宏任务队列有什么区别?是一样的吗?
关于 Nodejs 文档 here它说:
When setTimeout() is called, the Browser or Node.js starts the timer. Once the timer expires, in this case immediately as we put 0 as the timeout, the callback function is put in the Message Queue.
同时,在 this部分,它说:
A setTimeout, setImmediate callback is added to macrotask queue
那么,消息队列和宏任务队列是一回事吗?
最佳答案
这里指的是同一个东西。可以说“message queue”是一个更通用的术语,如“微任务队列和宏任务队列都是消息队列”。
关于javascript - Nodejs 消息队列 vs 宏任务队列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72643483/