mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-07 05:08:19 +00:00
Fix deadlock in Table implementation
This commit is contained in:
1
lib/api/src/externals/table.rs
vendored
1
lib/api/src/externals/table.rs
vendored
@@ -4,7 +4,6 @@ use crate::store::Store;
|
||||
use crate::types::{Val, ValFuncRef};
|
||||
use crate::RuntimeError;
|
||||
use crate::TableType;
|
||||
use std::sync::Arc;
|
||||
use wasmer_runtime::{Export, ExportTable, Table as RuntimeTable, VMCallerCheckedAnyfunc};
|
||||
|
||||
/// The `Table` struct is an array-like structure representing a WebAssembly Table,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::ValType;
|
||||
use std::borrow::{Borrow, BorrowMut};
|
||||
use std::cell::UnsafeCell;
|
||||
use std::convert::{TryFrom, TryInto};
|
||||
use std::convert::TryFrom;
|
||||
use std::ptr::NonNull;
|
||||
use std::sync::Mutex;
|
||||
use wasmer_runtime::{
|
||||
@@ -64,8 +64,10 @@ impl Table for LinearTable {
|
||||
|
||||
/// Returns the number of allocated elements.
|
||||
fn size(&self) -> u32 {
|
||||
let vec_guard = self.vec.lock().unwrap();
|
||||
vec_guard.borrow().len().try_into().unwrap()
|
||||
unsafe {
|
||||
let ptr = self.vm_table_definition.get();
|
||||
(*ptr).current_elements
|
||||
}
|
||||
}
|
||||
|
||||
/// Grow table by the specified amount of elements.
|
||||
|
||||
Reference in New Issue
Block a user