MCPcopy Index your code
hub / github.com/nodejs/node / insertGuarded

Function insertGuarded

lib/internal/timers.js:361–384  ·  view source on GitHub ↗
(item, refed)

Source from the content-addressed store, hash-verified

359// Appends a timer onto the end of an existing timers list, or creates a new
360// list if one does not already exist for the specified timeout duration.
361function insertGuarded(item, refed) {
362 const msecs = item._idleTimeout;
363 if (msecs < 0 || msecs === undefined)
364 return;
365
366 insert(item, msecs);
367
368 const isDestroyed = item._destroyed;
369 if (isDestroyed || !item[async_id_symbol]) {
370 item._destroyed = false;
371 initAsyncResource(item, 'Timeout');
372 }
373
374 if (isDestroyed) {
375 if (refed)
376 incRefCount();
377 } else if (refed === !item[kRefed]) {
378 if (refed)
379 incRefCount();
380 else
381 decRefCount();
382 }
383 item[kRefed] = refed;
384}
385
386// We need to use the binding as the receiver for fast API calls.
387function insert(item, msecs, start = binding.getLibuvNow()) {

Callers 2

activeFunction · 0.85
unrefActiveFunction · 0.85

Calls 4

insertFunction · 0.85
initAsyncResourceFunction · 0.85
incRefCountFunction · 0.85
decRefCountFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…