diff options
| author | ruki <[email protected]> | 2025-08-28 22:28:18 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-08-28 11:35:54 +0800 |
| commit | c316009d37c853c070030823c257d1cbcf94ea48 (patch) | |
| tree | 273f759f75957e3c27e8828e17623d24f713792c /core/src/xmake/thread/mutex_exit.c | |
| parent | c865267f3e781dc208f804efe8fa7f7fde53a064 (diff) | |
fix mutex cdata
Diffstat (limited to 'core/src/xmake/thread/mutex_exit.c')
| -rw-r--r-- | core/src/xmake/thread/mutex_exit.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/core/src/xmake/thread/mutex_exit.c b/core/src/xmake/thread/mutex_exit.c index 43c31c6c7..39d69ab8a 100644 --- a/core/src/xmake/thread/mutex_exit.c +++ b/core/src/xmake/thread/mutex_exit.c @@ -37,13 +37,10 @@ tb_int_t xm_thread_mutex_exit(lua_State* lua) { tb_assert_and_check_return_val(lua, 0); - if (!xm_lua_ispointer(lua, 1)) - return 0; + xm_thread_mutex_t* thread_mutex = xm_thread_mutex_get(lua, 1); + tb_assert_and_check_return_val(thread_mutex && thread_mutex->handle, 0); - xm_thread_mutex_t* thread_mutex = (xm_thread_mutex_t*)xm_lua_topointer(lua, 1); - tb_check_return_val(thread_mutex, 0); - - if (thread_mutex && tb_atomic_fetch_and_sub(&thread_mutex->refn, 1) == 1) + if (tb_atomic_fetch_and_sub(&thread_mutex->refn, 1) == 1) { if (thread_mutex->handle) { |
