denoland / denoland/rusty_v8

Reintroduce Locker API (multi-thread support)

Open
#643 6 comments 8 reactions 0 assignees View on GitHub
enhancement help wanted
Dominant language
Rust
Stars
3.9k
Forks
418
Avg merge
1d 20h
Merged PRs (30d)
6

Description

Lockers were removed in #272 but it's become clear they're necessary to access isolates from different threads and to make things like `--prof` work, that require an ambient isolate.

The straw-man proposal is something like this:

1. `Isolate` becomes `Send` but is basically an opaque object with no functionality.

2. Creating a `Locker` consumes or borrows the `Isolate` and gives you a `LocalIsolate` (name TBD) that's `!Send + !Sync`.

3. Dropping the locker gives you back the `Isolate`.

There's a complementary `Unlocker` API for yielding the isolate. It'd be nice to have but it might be hard to model in Rust.

Stretch goal: make `HandleScope::new()` work with both `Isolate` and `LocalIsolate` so downstream users by and large won't have to update their code?

Would fix #486, #639, and some others. Stands a good chance of obsoleting #602. Removes the need for 83052c45351768c2e8923d1bf557728e03fecbf6.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.