Last active
January 2, 2016 13:19
-
-
Save rmg/8309662 to your computer and use it in GitHub Desktop.
Domain double-pop
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
var domain = require('domain') | |
, d1 = new domain.Domain() | |
, d2 = new domain.Domain() | |
, d3 = new domain.Domain() | |
, d4 = new domain.Domain() | |
console.log("Starting: ", domain._stack) | |
d1.enter() | |
console.log("Entered d1: ", domain._stack) | |
d2.enter() | |
console.log("Entered d2: ", domain._stack) | |
d3.enter() | |
console.log("Entered d3: ", domain._stack) | |
d2.exit() | |
console.log("Exitted d2: ", domain._stack) | |
d2.exit() | |
console.log("Exitted d2 again: ", domain._stack) | |
d1.enter() | |
d2.enter() | |
d3.enter() | |
console.log("Re-entered d1, d2, d3: ", domain._stack) | |
d4.exit() | |
console.log("Exitted unused d4: ", domain._stack) |
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
Starting: [] | |
Entered d1: [ { domain: null, _events: {}, _maxListeners: 10, members: [] } ] | |
Entered d2: [ { domain: null, _events: {}, _maxListeners: 10, members: [] }, | |
{ domain: null, _events: {}, _maxListeners: 10, members: [] } ] | |
Entered d3: [ { domain: null, _events: {}, _maxListeners: 10, members: [] }, | |
{ domain: null, _events: {}, _maxListeners: 10, members: [] }, | |
{ domain: null, _events: {}, _maxListeners: 10, members: [] } ] | |
Exitted d2: [ { domain: null, _events: {}, _maxListeners: 10, members: [] } ] | |
Exitted d2 again: [] | |
Re-entered d1, d2, d3: [ { domain: null, _events: {}, _maxListeners: 10, members: [] }, | |
{ domain: null, _events: {}, _maxListeners: 10, members: [] }, | |
{ domain: null, _events: {}, _maxListeners: 10, members: [] } ] | |
Exitted unused d4: [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment