The original multi-thread support in v8 is limited, it use a global
lock to execute script in same thread one by one. It means, if you
want to allow another thread to execute script, you must first unlock
the current thread with PyV8.JSUnlocker and lock the new thread with
PyV8.JSLocker. Please check the testMultiJavascriptThread in PyV8.py
The good news is the latest V8 trunk code has added a new Isolated
concept, which allow us execute script in different script.
I'm still working on it, and design a new mechanism to simplify the
multi-thread support.
/**
* 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 can be used to synchronize.
*/
class V8EXPORT Isolate {