domain.exit()
exit()
方法退出当前域,将其从域堆栈中弹出。
任何时候执行将切换到不同异步调用链的上下文,确保退出当前域很重要。
对 exit()
的调用界定了异步调用链和绑定到域的 I/O 操作链的结束或中断。
如果有多个嵌套域绑定到当前执行上下文,则 exit()
将退出任何嵌套在该域中的域。
调用 exit()
只改变活动域,不改变域本身。
enter()
和 exit()
可以在单个域上调用任意次数。
The exit()
method exits the current domain, popping it off the domain stack.
Any time execution is going to switch to the context of a different chain of
asynchronous calls, it's important to ensure that the current domain is exited.
The call to exit()
delimits either the end of or an interruption to the chain
of asynchronous calls and I/O operations bound to a domain.
If there are multiple, nested domains bound to the current execution context,
exit()
will exit any domains nested within this domain.
Calling exit()
changes only the active domain, and does not alter the domain
itself. enter()
and exit()
can be called an arbitrary number of times on a
single domain.