Yes, I did that in the threads I lock and unlock the global isolate, and I
know that didn't make the threads run in parallel, because I used the same
isolate for the two threads, but I want just to run the two threads even if
one after the other, is this possible or what do you think?
I could post the code here if you want to take a look on it?



On Sat, Feb 15, 2014 at 7:41 PM, Ben Noordhuis <[email protected]> wrote:

> On Sat, Feb 15, 2014 at 5:37 PM, Sara Abdelhameed
> <[email protected]> wrote:
> > I want to create 2 context, one after the other and within these 2
> context
> > compile and execute javascript, and finally pass this contexts and
> compiled
> > javascript to two threads to execute the compiled script.
> > the scenario is:
> > 1- Create first context
> > 2- Enter this context using context scope and create string containing
> > javascript source code like"Hello, World"
> > 3- compile and execute this script
> > 4- Create the 2nd context
> > 5- Enter the 2nd context using context scope and create 2nd string
> > containing javascript code like "Good morning"
> > 6- compile and run the script
> > 7- declare 2 threads like this p_thread thread1, thread2;
> > 8- pass the first context and the first compiled string to the first
> thread
> > 9- pass the 2nd context and the 2nd compiled string to the 2nd thread
> > I tried to do this by different strategy but I failed to make it run
> > successfully, so is this scenario feasible? or it is impossible using
> > v8-engine?
> > thank you,
>
> If you intend to have those two threads run in parallel (and I assume
> you do), then no, that's not possible.  A context is tied to the
> isolate it's created in and an isolate is not safe to enter from
> multiple threads simultaneously.
>
> For the sake of completeness, you _can_ exit an isolate in one thread
> and then enter it again in another thread (see the Locker and Unlocker
> classes in v8.h) but I suspect that for you doing so defeats the
> purpose of having two threads in the first place.
>
> --
> --
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "v8-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/v8-users/SVdgPWTg7S8/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
-- 
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/groups/opt_out.

Reply via email to