rusty_v8
rusty_v8 copied to clipboard
Add Locker API
Fork of #738
@SpencerSharkey - I'm not trying to steal your thunder here, but I thought I'd try to move #738 forward a bit.
It is possible to obtain concurrent access to an Isolate from two different threads using the following route.
let mut isolate = Isolate::new(Default::default());
let handle = isolate.thread_safe_handle();
// On another thread:
let locker = &mut handle.lock();
That shouldn't be possible.
Bug: If an IsolateHandle is created with v8::Isolate::new_handle, the underlying isolate is never dropped because drop_annex is never called and the Arc<IsolateAnnex> has a cycle. Additionally, there is no way to drop the annex using only the public API.
Really looking forward for this to be done. 👍 Sadly not experienced enough to help with this myself ...
I just rebased this PR and fixed the tests again.
We are not merging this PR at this time because is has unaddressed safety issues and at least one memory leak. In Deno and Deno Deploy we don't need to access isolates from different threads so it's hard to evaluate whether this PR addresses the need.
We would appreciate help from the community to get this PR into a shape where we can land it.
closing because stale.