Don't know if you were at Node Summercamp, but we talked a lot about
domains. It's clear that there's lots of confusion about the semantics.
I've got some of the same questions. I had planned on finally sitting down
to explore them tomorrow. I can tell you that domains *are* nested. When
you start a new domain, it goes on a stack. And when you close it, you are
back in the previous domain.
:Marco
On Friday, September 14, 2012 6:52:38 AM UTC-7, phidelta wrote:
>
> Hi,
>
> I am really liking the new domains feature. However I have a question:
> "How do I leave a domain"
>
> Is my undesrtanding correct?:
>
> function b(callback) {
> // I am running inside the domain created in a
> fs.readFile('some-file', 'utf-8', function(err, val) {
> // I am running inside the domain created in a
> if (err) return callback(err);
> callback(undefined, val.replace('A','B'));
> });
> }
> function a() {
> var d=domain.create();
> d.run(b.bind(null, callback))
> }
> function callback() {
> // I am running inside the domain created in a
> }
>
> If so, then how do I leave a domain? Simply dispose of it? Then in which
> domain am I afterwards? Think nested domains. Am I in the one I was in
> before doing *domain.run()* in *a*?
>
> I I'm wrong in my understanding, then how do I ensure that all my async
> calls/callbacks remain in the domain I created?
>
> I would really appreciate if someone could explain this, since I am about
> to embark on some major efforts that would really benefit from using
> domains. Understanding how they work would be sort of fundamental ;)
>
> Regards,
> Philipp
>
>
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en