Prevent data races.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
use crate::any::{Dynamic, Variant};
|
||||
use crate::engine::{Engine, Imports, State};
|
||||
use crate::error::ParseError;
|
||||
use crate::fn_call::ensure_no_data_race;
|
||||
use crate::fn_native::{IteratorFn, SendSync};
|
||||
use crate::module::{FuncReturn, Module};
|
||||
use crate::optimize::{optimize_into_ast, OptimizationLevel};
|
||||
@@ -1282,6 +1283,11 @@ impl Engine {
|
||||
let mut mods = Imports::new();
|
||||
let args = args.as_mut();
|
||||
|
||||
// Check for data race.
|
||||
if cfg!(not(feature = "no_shared")) {
|
||||
ensure_no_data_race(name, args, false)?;
|
||||
}
|
||||
|
||||
self.call_script_fn(
|
||||
scope, &mut mods, &mut state, lib, this_ptr, name, fn_def, args, 0,
|
||||
)
|
||||
|
Reference in New Issue
Block a user