mirror of
https://github.com/denoland/rusty_v8.git
synced 2024-12-27 01:29:19 -05:00
There should be a single entry point for creating IsolateHandle (#361)
This commit is contained in:
parent
db5bbf6e43
commit
11340c9ca3
2 changed files with 9 additions and 3 deletions
|
@ -59,7 +59,7 @@ impl<T> Global<T> {
|
|||
Self {
|
||||
value: other_value
|
||||
.map(|v| unsafe { transmute(v8__Global__New(isolate, transmute(v))) }),
|
||||
isolate_handle: other_value.map(|_| IsolateHandle::new(isolate)),
|
||||
isolate_handle: other_value.map(|_| isolate.thread_safe_handle()),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ impl<T> Global<T> {
|
|||
)
|
||||
},
|
||||
}
|
||||
self.isolate_handle = other_value.map(|_| IsolateHandle::new(isolate));
|
||||
self.isolate_handle = other_value.map(|_| isolate.thread_safe_handle());
|
||||
}
|
||||
|
||||
/// If non-empty, destroy the underlying storage cell
|
||||
|
|
|
@ -431,6 +431,12 @@ impl IsolateAnnex {
|
|||
}
|
||||
}
|
||||
|
||||
/// IsolateHandle is a thread-safe reference to an Isolate. It's main use is to
|
||||
/// terminate execution of a running isolate from another thread.
|
||||
///
|
||||
/// It is created with Isolate::thread_safe_handle().
|
||||
///
|
||||
/// IsolateHandle is Cloneable, Send, and Sync.
|
||||
#[derive(Clone)]
|
||||
pub struct IsolateHandle(Arc<IsolateAnnex>);
|
||||
|
||||
|
@ -445,7 +451,7 @@ impl IsolateHandle {
|
|||
self.0.isolate
|
||||
}
|
||||
|
||||
pub(crate) fn new(isolate: &mut Isolate) -> Self {
|
||||
fn new(isolate: &mut Isolate) -> Self {
|
||||
Self(isolate.get_annex_arc())
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue