summaryrefslogtreecommitdiff
path: root/core/src/xmake/thread/prefix.h
diff options
context:
space:
mode:
authorruki <[email protected]>2025-08-28 22:28:18 +0800
committerruki <[email protected]>2025-08-28 11:35:54 +0800
commitc316009d37c853c070030823c257d1cbcf94ea48 (patch)
tree273f759f75957e3c27e8828e17623d24f713792c /core/src/xmake/thread/prefix.h
parentc865267f3e781dc208f804efe8fa7f7fde53a064 (diff)
fix mutex cdata
Diffstat (limited to 'core/src/xmake/thread/prefix.h')
-rw-r--r--core/src/xmake/thread/prefix.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/src/xmake/thread/prefix.h b/core/src/xmake/thread/prefix.h
index 08eeb73a5..62e1c7729 100644
--- a/core/src/xmake/thread/prefix.h
+++ b/core/src/xmake/thread/prefix.h
@@ -47,6 +47,14 @@ typedef struct __xm_thread_mutex_t
}xm_thread_mutex_t;
+// get the thread mutex from arguments
+static __tb_inline__ xm_thread_mutex_t* xm_thread_mutex_get(lua_State* lua, tb_int_t index)
+{
+ xm_thread_mutex_t* thread_mutex = tb_null;
+ if (xm_lua_isinteger(lua, index)) thread_mutex = (xm_thread_mutex_t*)(tb_size_t)(tb_long_t)lua_tointeger(lua, index);
+ else if (xm_lua_ispointer(lua, index)) thread_mutex = (xm_thread_mutex_t*)xm_lua_topointer(lua, index);
+ return thread_mutex;
+}
#endif