From 621af21e6eab9b0f736d5b6e8acc48dbad4a68d2 Mon Sep 17 00:00:00 2001 From: andy finch Date: Thu, 18 Jul 2019 20:23:14 -0400 Subject: only use Locker when calling into js (#2665) --- core/isolate.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'core/isolate.rs') diff --git a/core/isolate.rs b/core/isolate.rs index 38f7b7987..af9d07f75 100644 --- a/core/isolate.rs +++ b/core/isolate.rs @@ -550,9 +550,6 @@ impl Future for Isolate { type Error = ErrBox; fn poll(&mut self) -> Poll<(), ErrBox> { - // Lock the current thread for V8. - let _locker = LockerScope::new(self.libdeno_isolate); - self.shared_init(); let mut overflow_response: Option = None; @@ -590,14 +587,20 @@ impl Future for Isolate { } if self.shared.size() > 0 { + // Lock the current thread for V8. + let locker = LockerScope::new(self.libdeno_isolate); self.respond(None)?; // The other side should have shifted off all the messages. assert_eq!(self.shared.size(), 0); + drop(locker); } if overflow_response.is_some() { + // Lock the current thread for V8. + let locker = LockerScope::new(self.libdeno_isolate); let buf = overflow_response.take().unwrap(); self.respond(Some(&buf))?; + drop(locker); } self.check_promise_errors(); -- cgit v1.2.3