On Thu, Aug 14, 2014 at 1:08 AM, Mark Tarrabain <[email protected]> wrote:
> Hello,
>
> I'm sort of new to using the v8 C++ api, and I've read the embedder's guide
> already, but I am a bit confused on what the proper way to accomplish what
> I'm trying to do is..
>
> I am writing a multithreaded program where different threads are going to
> have their own isolate and context, since some of them could be running at
> the same time, and I want the different threads to be largely invisible to
> eachother  I am wanting, however, for each of these newly created contexts
> to inherit everything from a "master" context that I create in the program's
> main thread before any of the other threads get created.  In particular, the
> main thread compiles and runs several scripts whose effects I want to
> propogate forward  (mostly the defining of functions and a few global
> variables) with each newly created context, and I am hoping I can find a way
> to avoid recompiling these scripts for each and every context that I want
> create individually in each of the following threads.
>
> Any suggestions would be most welcome.
> Thanks in advance,
> Mark

Hi, the short answer to your question is "that's not possible."

When you say "context", you mean a v8::Context, right?  You can
compile scripts in a way that is context-independent (meaning you can
run them in multiple contexts in the same isolate) but you cannot move
them from one isolate to another.

You can use the same isolate in multiple threads (with appropriate use
of the v8::Locker and v8::Unlocker APIs) but whether that's useful to
you, is something you'll have to decide for yourself.  :-)

-- 
-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to