diff options
author | andy finch <andyfinch7@gmail.com> | 2019-07-18 20:23:14 -0400 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-07-18 20:23:14 -0400 |
commit | 621af21e6eab9b0f736d5b6e8acc48dbad4a68d2 (patch) | |
tree | 8f872b81ef4b3c21337e51dcdc44b287f78705e9 /core/isolate.rs | |
parent | 042484d45afe129f0c08d387870e4c6de019c34b (diff) |
only use Locker when calling into js (#2665)
Diffstat (limited to 'core/isolate.rs')
-rw-r--r-- | core/isolate.rs | 9 |
1 files changed, 6 insertions, 3 deletions
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<Buf> = 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(); |