diff options
| author | ruki <[email protected]> | 2025-04-16 22:35:33 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-08-28 11:35:53 +0800 |
| commit | 8bf1576c641f3b68bb43c50929cdcec8ee73ff86 (patch) | |
| tree | cecd4927e8466e076687f6b23d60f00a06023aae /core/src/xmake/engine.c | |
| parent | d985de5de38fb0d041f8e9182c076575603b5b4f (diff) | |
add native thread stub
Diffstat (limited to 'core/src/xmake/engine.c')
| -rw-r--r-- | core/src/xmake/engine.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/core/src/xmake/engine.c b/core/src/xmake/engine.c index 69853c1f9..fa3462c7d 100644 --- a/core/src/xmake/engine.c +++ b/core/src/xmake/engine.c @@ -329,6 +329,12 @@ tb_int_t xm_utils_bin2c(lua_State* lua); tb_int_t xm_lua_curses_register(lua_State* lua, tb_char_t const* module); #endif +// the thread functions +tb_int_t xm_thread_init(lua_State* lua); +tb_int_t xm_thread_exit(lua_State* lua); +tb_int_t xm_thread_suspend(lua_State* lua); +tb_int_t xm_thread_resume(lua_State* lua); + // open cjson __tb_extern_c_enter__ tb_int_t luaopen_cjson(lua_State *l); @@ -615,6 +621,16 @@ static luaL_Reg const g_utils_functions[] = , { tb_null, tb_null } }; +// the thread functions +static luaL_Reg const g_thread_functions[] = +{ + { "thread_init", xm_thread_init } +, { "thread_exit", xm_thread_exit } +, { "thread_resume", xm_thread_resume } +, { "thread_suspend", xm_thread_suspend } +, { tb_null, tb_null } +}; + // the lua global instance for signal handler static lua_State* g_lua = tb_null; @@ -1405,6 +1421,9 @@ xm_engine_ref_t xm_engine_init(tb_char_t const* name, xm_engine_lni_initalizer_c // bind utils functions xm_lua_register(engine->lua, "utils", g_utils_functions); + // bind thread functions + xm_lua_register(engine->lua, "thread", g_thread_functions); + #ifdef XM_CONFIG_API_HAVE_CURSES // bind curses xm_lua_curses_register(engine->lua, "curses"); |
