
mina框架为什么能实现高并发
1个回答
展开全部
mina框架为什么能实现高并发
Running Concurrently
Running a JavaScript function in the background is easy with Er.js:
Er.spawn(myBackgroundFunction);
Er.spawn starts a new Er.js process running
myBackgroundFunction, and returns its process id.
Because processes are really coroutines, you have to call yield
before any function which might block. Calling yield will create a
continuation trampoline that can be rerun by Er.js when it’s time for the
process to continue executing. For example:
function myBackgroundFunction() {
// Wait for 4 seconds
yield Er.sleep(4000);
// Do other things…
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询