From adbc9ccc9be5d24ff56275938aebb11529ec7399 Mon Sep 17 00:00:00 2001 From: Alex Orlenko Date: Thu, 8 Jul 2021 15:37:18 +0100 Subject: Move away from metatable hashmap cache to direct keys --- src/thread.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/thread.rs') diff --git a/src/thread.rs b/src/thread.rs index 403eb78..7a10d46 100644 --- a/src/thread.rs +++ b/src/thread.rs @@ -13,7 +13,7 @@ use crate::function::Function; #[cfg(feature = "async")] use { crate::{ - lua::{ASYNC_POLL_PENDING, WAKER_REGISTRY_KEY}, + lua::{ASYNC_POLL_PENDING, WAKER_MT, WAKER_REGISTRY_KEY}, util::get_gc_userdata, value::Value, }, @@ -362,7 +362,7 @@ impl WakerGuard { let waker_key = &WAKER_REGISTRY_KEY as *const u8 as *const c_void; ffi::lua_rawgetp(state, ffi::LUA_REGISTRYINDEX, waker_key); - let waker_slot = get_gc_userdata::>(state, -1).as_mut(); + let waker_slot = get_gc_userdata::>(state, -1, &WAKER_MT).as_mut(); let old = mlua_expect!(waker_slot, "Waker is destroyed").replace(waker); Ok(WakerGuard(state, old)) @@ -380,7 +380,7 @@ impl Drop for WakerGuard { let waker_key = &WAKER_REGISTRY_KEY as *const u8 as *const c_void; ffi::lua_rawgetp(state, ffi::LUA_REGISTRYINDEX, waker_key); - let waker_slot = get_gc_userdata::>(state, -1).as_mut(); + let waker_slot = get_gc_userdata::>(state, -1, &WAKER_MT).as_mut(); mem::swap(mlua_expect!(waker_slot, "Waker is destroyed"), &mut self.1); } } -- cgit v1.2.3