Shared variant of Dynamic type; All read/write access operations in Dynamic backed by Read/Write lock guards; new shared() script function

This commit is contained in:
Ilya Lakhin
2020-07-27 11:30:09 +07:00
parent 721c578407
commit e5fe222de3
11 changed files with 383 additions and 73 deletions

View File

@@ -34,7 +34,7 @@ fn pad<T: Variant + Clone>(
_: &Module,
args: &mut [&mut Dynamic],
) -> FuncReturn<()> {
let len = *args[1].downcast_ref::<INT>().unwrap();
let len = *args[1].read_lock::<INT>().unwrap();
// Check if array will be over max size limit
#[cfg(not(feature = "unchecked"))]
@@ -52,7 +52,7 @@ fn pad<T: Variant + Clone>(
if len > 0 {
let item = args[2].clone();
let list = args[0].downcast_mut::<Array>().unwrap();
let mut list = args[0].write_lock::<Array>().unwrap();
if len as usize > list.len() {
list.resize(len as usize, item);