*Overview:*

I have a NodeJS server with a few C++ modules in it, executing one overall 
"job". Some objects (C++ objects, let's say "singletons") in these modules 
are common and their states after initialization should be shared between 
each module. The initialization of those objects has to be done once during 
server startup.

*Example:*

A, B - separate C++ modules which should be executed as one job

x, y, z - shared C++ objects (possibly a lot of them)

   1. Server receives a (http) request and processes it in *A* using *x*, 
   *y* and *z*.
   2. The (http) response goes from *A* to the client.
   3. Server receives another (http) request and processes it in *B* also 
   using *x*, *y* and *z*.
   4. The (http) response goes from *B* to the client.

*Questions:*

Can you tell me if there is some known best practice of initialization and 
sharing of these objects between all C++ modules?

What is the lifecycle of a particular C++ module in NodeJS? When are they 
removed from the memory?

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/43a85dde-2024-4818-a5f0-f3e9d0e55543%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to