forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
timer: call list.start regardless new or not
Call start regardless whether list is new or not to prevent incorrect active_handles count. Fixes nodejs/node-v0.x-archive#25831
- Loading branch information
Showing
4 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <node.h> | ||
#include <uv.h> | ||
|
||
using namespace v8; | ||
|
||
void Method(const FunctionCallbackInfo<Value>& args) { | ||
Isolate* isolate = args.GetIsolate(); | ||
int hCnt = uv_default_loop()->active_handles; | ||
uv_run(uv_default_loop(), UV_RUN_ONCE); | ||
args.GetReturnValue().Set(Integer::New(isolate, hCnt)); | ||
} | ||
|
||
void init(Handle<Object> exports) { | ||
NODE_SET_METHOD(exports, "run", Method); | ||
} | ||
|
||
NODE_MODULE(deasync, init) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
'targets': [ | ||
{ | ||
'target_name': 'binding', | ||
'sources': [ 'binding.cc' ] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use strict'; | ||
|
||
const assert = require('assert'); | ||
var uvRunOnce = require('./build/Release/binding'); | ||
setTimeout(function () { | ||
var res; | ||
setTimeout(function () { | ||
res = true; | ||
}, 2); | ||
while (!res && uvRunOnce.run()) { | ||
} | ||
assert.equal(res, true); | ||
}, 2); |