-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
So that each nextTick callback is treated as its own asynchronous event, add a unique id to new TickObject instances. This is a preliminary for allowing the async wrap callbacks to run with nextTick callbacks.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
'use strict'; | ||
|
||
const async_wrap = process.binding('async_wrap'); | ||
const uidArray = async_wrap.getUidArray(); | ||
|
||
module.exports.getUid = | ||
process.binding('os').isBigEndian ? getUidBE : getUidLE; | ||
|
||
|
||
function getUidLE() { | ||
if (uidArray[0] === 0xffffffff) { | ||
uidArray[0] = 0; | ||
uidArray[1]++; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
trevnorris
Author
Owner
|
||
} | ||
return uidArray[0] + uidArray[1] * 0x100000000; | ||
} | ||
|
||
function getUidBE() { | ||
if (uidArray[1] === 0xffffffff) { | ||
uidArray[1] = 0; | ||
uidArray[0]++; | ||
} | ||
return uidArray[1] + uidArray[0] * 0x100000000; | ||
} |
@trevnorris - is this ++ intended to increment the value? And is this expected to update the memory in the runtime?