### Navigation

- index
- modules |
- next |
- previous |
- PyV8 v1.0beta documentation »
- Public API »

# Multi-Thread and Lock

## The Javascript Thread and Isolate

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.

## JSIsolate

class `PyV8.``JSIsolate`
  `__enter__`() → JSIsolate object
  `__exit__`(exc_type, exc_value, traceback) → None
  `enter`()
    enter( (JSIsolate)arg1) -> None :

      Sets this isolate as the entered one for the current thread. Saves the previously entered one (if any), so that it can be restored when exiting. Re-entering an isolate is allowed.

      C++ signature :
        void enter(class CIsolate {lvalue})
  `leave`()
    leave( (JSIsolate)arg1) -> None :

      Exits this isolate by restoring the previously entered one in the current thread. The isolate may still stay the same, if it was entered more than once.

      C++ signature :
        void leave(class CIsolate {lvalue})

### Navigation

- index
- modules |
- next |
- previous |
- PyV8 v1.0beta documentation »
- Public API »