0

I plan to embed Google V8 in my C++ application, which is a multi-threading process. I need to run multiple Javascripts concurrently. Can I create multiple V8 contexts and run different Javascripts in different contexts simultaneously in different threads? Each context has no need to communicate with others. I just want no lock or wait for script concurrent executing. Thanks!

Bergi
  • 630,263
  • 148
  • 957
  • 1,375
xiagao1982
  • 1,077
  • 1
  • 13
  • 25

1 Answers1

0

Yes, as long as the contexts are from different Isolates.

Each isolate can only be entered by one thread at a time and you need to use v8::Locker to lock the isolate to the particular thread.

xaxxon
  • 19,189
  • 5
  • 50
  • 80