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§
source§impl 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§
source§impl Clone for IsolateHandle
impl Clone for IsolateHandle
source§fn clone(&self) -> IsolateHandle
fn clone(&self) -> IsolateHandle
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more