有没有办法知道在nodejs程序的主循环中要执行的挂起的“线程”/tasks的数量?
我们知道,一个非常基本的setInterval/setTimeout/process.nextTick将在堆栈中创建一个标记,以防止程序死亡,但是有没有方法来反思这一点呢?
//in some module
//some js code
return 22;
//is the program still active after this line or not ?我想我在搜索一个"process.hasPendingTasks()“或者类似的东西...
发布于 2015-10-12 21:16:05
这里有一些未记录的函数:
process._getActiveHandles();
process._getActiveRequests();这应该会为您提供一些信息,告诉您还需要执行哪些操作。
https://stackoverflow.com/questions/33081826
复制相似问题