diff options
author | Bert Belder <bertbelder@gmail.com> | 2018-10-07 23:48:06 +0200 |
---|---|---|
committer | Bert Belder <bertbelder@gmail.com> | 2018-10-08 18:19:32 +0200 |
commit | e742af10aa67dc90a68fcb60b8e70733fd753e68 (patch) | |
tree | bc9d7360c5a8cb94e93f9dabf5749b94addc0c18 /src/libdeno.rs | |
parent | d86e5d2605c68606c8073d1b563d3389ea93c112 (diff) |
Abide by the rules when passing Isolate between c and rust
Ensure that at most one mutable Isolate reference exists at a time.
`deno_execute()` and `deno_respond()` now borrow a reference to the rust-side
isolate from the caller. When we need a reference to the isolate while one of
these functions is on the stack, `deno_get_data()` can be used to borrow back
that reference.
Diffstat (limited to 'src/libdeno.rs')
-rw-r--r-- | src/libdeno.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/libdeno.rs b/src/libdeno.rs index b48ddd166..77f7f5c3e 100644 --- a/src/libdeno.rs +++ b/src/libdeno.rs @@ -30,13 +30,19 @@ extern "C" { pub fn deno_init(); pub fn deno_v8_version() -> *const c_char; pub fn deno_set_v8_flags(argc: *mut c_int, argv: *mut *mut c_char); - pub fn deno_new(user_data: *mut c_void, cb: DenoRecvCb) -> *const isolate; + pub fn deno_new(cb: DenoRecvCb) -> *const isolate; pub fn deno_delete(i: *const isolate); pub fn deno_last_exception(i: *const isolate) -> *const c_char; pub fn deno_get_data(i: *const isolate) -> *mut c_void; - pub fn deno_respond(i: *const isolate, req_id: i32, buf: deno_buf); + pub fn deno_respond( + i: *const isolate, + user_data: *mut c_void, + req_id: i32, + buf: deno_buf, + ); pub fn deno_execute( i: *const isolate, + user_data: *mut c_void, js_filename: *const c_char, js_source: *const c_char, ) -> c_int; |