rusty_v8 icon indicating copy to clipboard operation
rusty_v8 copied to clipboard

Attempted to implement `Locker` for `Isolate`.

Open Earthmark opened this issue 11 months ago • 3 comments

This adds a wrapper SharedIsolate for OwnedIsolate (this way all the support code in OwnedIsolate doesn't need to be re-created).

Originally an Unlocker was added as well, but an Unlocker being used inside a Locker would result in HandleScope instance failing to be created once the Unlocker dropped.

This may be indicating that some part of the Locker api itself isn't working properly with rusty_v8's OwnedIsolate overhead, but the example code does appear to work as expected.

As Unlocker isn't a direct needed in my use case, it was removed in lue of implementing a bare minimum locker.

I can investigate more into what happened to the unlocker if needed, and there are some open questions about how OwnedIsolate is dropped, where it isn't technically locked, even though drop can only happen on one thread once all lockers have been themselves dropped.

Earthmark avatar Mar 03 '24 23:03 Earthmark

This should partially resolve #643, unlockers and recursive lockers are not part of this proposal.

Earthmark avatar Mar 04 '24 00:03 Earthmark

Turns out there are issues found in CI! I'll poke at that for now.

Earthmark avatar Mar 04 '24 08:03 Earthmark

https://github.com/denoland/rusty_v8/pull/1442 should deal with the construction changes, simplifying this PR.

Earthmark avatar Mar 17 '24 19:03 Earthmark