See V8 API docs in
https://code.google.com/p/chromium/codesearch#chromium/src/v8/include/v8.h
/**
* Isolate represents an isolated instance of the V8 engine. V8
* isolates have completely separate states. Objects from one isolate
* must not be used in other isolates. When V8 is initialized a
* default isolate is implicitly created and entered. The embedder
* can create additional isolates and use them in parallel in multiple
* threads. An isolate can be entered by at most one thread at any
* given time. The Locker/Unlocker API must be used to synchronize.
*/
/**
* Multiple threads in V8 are allowed, but only one thread at a time is
allowed
* to use any given V8 isolate, see the comments in the Isolate class. The
* definition of 'using a V8 isolate' includes accessing handles or holding
onto
* object pointers obtained from V8 handles while in the particular V8
isolate.
* It is up to the user of V8 to ensure, perhaps with locking, that this
* constraint is not violated. In addition to any other synchronization
* mechanism that may be used, the v8::Locker and v8::Unlocker classes must
be
* used to signal thead switches to V8.
*/
On Mon, Sep 23, 2013 at 1:17 PM, Torne (Richard Coles)
Post by Torne (Richard Coles)Post by Ashish NegiI am making an application with v8 as a library. I created 2 threads with
each of them having different isolates. And it was "able" to run javascript
in both the threads. Was that just by chance or it is possible ? When
different threads ask for executing code to v8 parallely, would they get
into a line automatically ? Is there a chance of them getting lost ?
You can run different isolates on different threads at the same time with
V8, yes. However, there is only one Blink thread per renderer process in
Chromium, and because V8 shares the DOM with Blink, V8 must run on the
single Blink thread.
So, if you're just embedding V8 in your app standalone, then what you're
doing is fine, but Chromium can't do that because our V8 shares state with
the non-multithreaded rendering engine; even though they are separate
isolates only one can run at a time.
Post by Ashish NegiPost by PhistucKAs far as I have experienced, all of them execute on the same main thread.
â*PhistucK*
Post by Ashish NegiSo when many tabs use same v8, Does all of them push the javascript
code on the main thread or can their be multi-threaded execution for each
of these single-threaded tabs?
Post by Jakob KummerowWhen several tabs share a renderer, they also share that renderer's
V8 instance,
--
--
http://groups.google.com/a/**chromium.org/group/chromium-**dev<http://groups.google.com/a/chromium.org/group/chromium-dev>
To unsubscribe from this group and stop receiving emails from it, send
--
--
http://groups.google.com/a/chromium.org/group/chromium-dev
To unsubscribe from this group and stop receiving emails from it, send an
--
--
http://groups.google.com/a/chromium.org/group/chromium-dev
--
--
Chromium Developers mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev+***@chromium.org.