From 60c008d23b2bdad333711b43148a5053e83a62cc Mon Sep 17 00:00:00 2001 From: F001 Date: Wed, 5 Dec 2018 12:36:10 +0800 Subject: Isolate::from_raw_ptr and other cleanups. `Isolate::from_void_ptr` is renamed to `from_raw_ptr`, to keep consistency with std libs. It is changed to `unsafe` function, because it can't guarantee that the input is valid. This guarantee should be provided by the caller. Its return type is changed to `&Isolate`, because `&mut Isolate` type requires that no other aliases co-exist in this period of time, this does not seem true. So I changed most of the methods to accept shared reference `&Isolate`. It is easier to reason about the correctness of `unsafe` blocks. As long as these shared references are in the same thread, these `unsafe` codes are probably correct. --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 1224d2af2..f2e241ab1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -98,7 +98,7 @@ fn main() { let state = Arc::new(isolate::IsolateState::new(flags, rest_argv)); let snapshot = snapshot::deno_snapshot(); - let mut isolate = isolate::Isolate::new(snapshot, state, ops::dispatch); + let isolate = isolate::Isolate::new(snapshot, state, ops::dispatch); tokio_util::init(|| { isolate .execute("deno_main.js", "denoMain();") -- cgit v1.2.3