| Index: include/v8.h
|
| diff --git a/include/v8.h b/include/v8.h
|
| index 98d0b5dba4a3f8e08d7326ce2f30363bc2885b88..b621f0110a519378621cae992e59f6ddc8635049 100644
|
| --- a/include/v8.h
|
| +++ b/include/v8.h
|
| @@ -3355,20 +3355,26 @@ class V8EXPORT Context {
|
| * to the user of V8 to ensure (perhaps with locking) that this
|
| * constraint is not violated.
|
| *
|
| - * v8::Locker is a scoped lock object. While it's
|
| - * active (i.e. between its construction and destruction) the current thread is
|
| - * allowed to use the locked isolate. V8 guarantees that an isolate can be locked
|
| - * by at most one thread at any time. In other words, the scope of a v8::Locker is
|
| - * a critical section.
|
| + * More then one thread and multiple V8 isolates can be used
|
| + * without any locking if each isolate is created and accessed
|
| + * by a single thread only. For example, one thread can use
|
| + * multiple isolates or multiple threads can each create and run
|
| + * their own isolate.
|
| *
|
| - * Sample usage:
|
| -* \code
|
| + * If you wish to start using V8 isolate in more then one thread
|
| + * you can do this by constructing a v8::Locker object to guard
|
| + * access to the isolate. After the code using V8 has completed
|
| + * for the current thread you can call the destructor. This can
|
| + * be combined with C++ scope-based construction as follows
|
| + * (assumes the default isolate that is used if not specified as
|
| + * a parameter for the Locker):
|
| + *
|
| + * \code
|
| * ...
|
| * {
|
| - * v8::Locker locker(isolate);
|
| - * v8::Isolate::Scope isolate_scope(isolate);
|
| + * v8::Locker locker;
|
| * ...
|
| - * // Code using V8 and isolate goes here.
|
| + * // Code using V8 goes here.
|
| * ...
|
| * } // Destructor called here
|
| * \endcode
|
| @@ -3379,13 +3385,11 @@ class V8EXPORT Context {
|
| *
|
| * \code
|
| * {
|
| - * isolate->Exit();
|
| - * v8::Unlocker unlocker(isolate);
|
| + * v8::Unlocker unlocker;
|
| * ...
|
| * // Code not using V8 goes here while V8 can run in another thread.
|
| * ...
|
| * } // Destructor called here.
|
| - * isolate->Enter();
|
| * \endcode
|
| *
|
| * The Unlocker object is intended for use in a long-running callback
|
| @@ -3405,45 +3409,32 @@ class V8EXPORT Context {
|
| * \code
|
| * // V8 not locked.
|
| * {
|
| - * v8::Locker locker(isolate);
|
| - * Isolate::Scope isolate_scope(isolate);
|
| + * v8::Locker locker;
|
| * // V8 locked.
|
| * {
|
| - * v8::Locker another_locker(isolate);
|
| + * v8::Locker another_locker;
|
| * // V8 still locked (2 levels).
|
| * {
|
| - * isolate->Exit();
|
| - * v8::Unlocker unlocker(isolate);
|
| + * v8::Unlocker unlocker;
|
| * // V8 not locked.
|
| * }
|
| - * isolate->Enter();
|
| * // V8 locked again (2 levels).
|
| * }
|
| * // V8 still locked (1 level).
|
| * }
|
| * // V8 Now no longer locked.
|
| * \endcode
|
| - *
|
| - *
|
| */
|
| class V8EXPORT Unlocker {
|
| public:
|
| - /**
|
| - * Initialize Unlocker for a given Isolate. NULL means default isolate.
|
| - */
|
| - explicit Unlocker(Isolate* isolate = NULL);
|
| + Unlocker();
|
| ~Unlocker();
|
| - private:
|
| - internal::Isolate* isolate_;
|
| };
|
|
|
|
|
| class V8EXPORT Locker {
|
| public:
|
| - /**
|
| - * Initialize Locker for a given Isolate. NULL means default isolate.
|
| - */
|
| - explicit Locker(Isolate* isolate = NULL);
|
| + Locker();
|
| ~Locker();
|
|
|
| /**
|
| @@ -3461,10 +3452,9 @@ class V8EXPORT Locker {
|
| static void StopPreemption();
|
|
|
| /**
|
| - * Returns whether or not the locker for a given isolate, or default isolate if NULL is given,
|
| - * is locked by the current thread.
|
| + * Returns whether or not the locker is locked by the current thread.
|
| */
|
| - static bool IsLocked(Isolate* isolate = NULL);
|
| + static bool IsLocked();
|
|
|
| /**
|
| * Returns whether v8::Locker is being used by this V8 instance.
|
| @@ -3474,7 +3464,6 @@ class V8EXPORT Locker {
|
| private:
|
| bool has_lock_;
|
| bool top_level_;
|
| - internal::Isolate* isolate_;
|
|
|
| static bool active_;
|
|
|
|
|