%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
'use strict'; // Test that async ids that are added to the destroy queue while running a // `destroy` callback are handled correctly. const common = require('../common'); const assert = require('assert'); const async_hooks = require('async_hooks'); const initCalls = new Set(); let destroyResCallCount = 0; let res2; async_hooks.createHook({ init: common.mustCallAtLeast((id, provider) => { if (provider === 'foobar') initCalls.add(id); }, 2), destroy: common.mustCallAtLeast((id) => { if (!initCalls.has(id)) return; switch (destroyResCallCount++) { case 0: // Trigger the second `destroy` call. res2.emitDestroy(); break; case 2: assert.fail('More than 2 destroy() invocations'); break; } }, 2) }).enable(); const res1 = new async_hooks.AsyncResource('foobar'); res2 = new async_hooks.AsyncResource('foobar'); res1.emitDestroy(); process.on('exit', () => assert.strictEqual(destroyResCallCount, 2));