Struct v8::IsolateHandle
source · [−]pub struct IsolateHandle(_);
Expand description
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.
Implementations
sourceimpl IsolateHandle
impl IsolateHandle
sourcepub fn terminate_execution(&self) -> bool
pub fn terminate_execution(&self) -> bool
Forcefully terminate the current thread of JavaScript execution in the given isolate.
This method can be used by any thread even if that thread has not acquired the V8 lock with a Locker object.
Returns false if Isolate was already destroyed.
sourcepub fn cancel_terminate_execution(&self) -> bool
pub fn cancel_terminate_execution(&self) -> bool
Resume execution capability in the given isolate, whose execution was previously forcefully terminated using TerminateExecution().
When execution is forcefully terminated using TerminateExecution(), the isolate can not resume execution until all JavaScript frames have propagated the uncatchable exception which is generated. This method allows the program embedding the engine to handle the termination event and resume execution capability, even if JavaScript frames remain on the stack.
This method can be used by any thread even if that thread has not acquired the V8 lock with a Locker object.
Returns false if Isolate was already destroyed.
sourcepub fn is_execution_terminating(&self) -> bool
pub fn is_execution_terminating(&self) -> bool
Is V8 terminating JavaScript execution.
Returns true if JavaScript execution is currently terminating because of a call to TerminateExecution. In that case there are still JavaScript frames on the stack and the termination exception is still active.
Returns false if Isolate was already destroyed.
sourcepub fn request_interrupt(
&self,
callback: extern "C" fn(isolate: &mut Isolate, data: *mut c_void),
data: *mut c_void
) -> bool
pub fn request_interrupt(
&self,
callback: extern "C" fn(isolate: &mut Isolate, data: *mut c_void),
data: *mut c_void
) -> bool
Request V8 to interrupt long running JavaScript code and invoke the given |callback| passing the given |data| to it. After |callback| returns control will be returned to the JavaScript code. There may be a number of interrupt requests in flight. Can be called from another thread without acquiring a |Locker|. Registered |callback| must not reenter interrupted Isolate.
Returns false if Isolate was already destroyed.
Trait Implementations
sourceimpl Clone for IsolateHandle
impl Clone for IsolateHandle
sourcefn clone(&self) -> IsolateHandle
fn clone(&self) -> IsolateHandle
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for IsolateHandle
impl Debug for IsolateHandle
impl Send for IsolateHandle
impl Sync for IsolateHandle
Auto Trait Implementations
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more