aboutsummaryrefslogtreecommitdiff
path: root/src/lanes.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lanes.c')
-rw-r--r--src/lanes.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lanes.c b/src/lanes.c
index 72f9dd6..f43a2e6 100644
--- a/src/lanes.c
+++ b/src/lanes.c
@@ -2022,6 +2022,17 @@ LUAG_FUNC( set_thread_priority)
2022 return 0; 2022 return 0;
2023} 2023}
2024 2024
2025LUAG_FUNC( set_thread_affinity)
2026{
2027 lua_Integer affinity = luaL_checkinteger( L, 1);
2028 if( affinity <= 0)
2029 {
2030 return luaL_error( L, "invalid affinity (%d)", affinity);
2031 }
2032 THREAD_SET_AFFINITY( (unsigned int) affinity);
2033 return 0;
2034}
2035
2025#if USE_DEBUG_SPEW 2036#if USE_DEBUG_SPEW
2026// can't use direct LUA_x errcode indexing because the sequence is not the same between Lua 5.1 and 5.2 :-( 2037// can't use direct LUA_x errcode indexing because the sequence is not the same between Lua 5.1 and 5.2 :-(
2027// LUA_ERRERR doesn't have the same value 2038// LUA_ERRERR doesn't have the same value
@@ -2995,6 +3006,7 @@ static const struct luaL_Reg lanes_functions [] = {
2995 {"now_secs", LG_now_secs}, 3006 {"now_secs", LG_now_secs},
2996 {"wakeup_conv", LG_wakeup_conv}, 3007 {"wakeup_conv", LG_wakeup_conv},
2997 {"set_thread_priority", LG_set_thread_priority}, 3008 {"set_thread_priority", LG_set_thread_priority},
3009 {"set_thread_affinity", LG_set_thread_affinity},
2998 {"nameof", luaG_nameof}, 3010 {"nameof", luaG_nameof},
2999 {"register", LG_register}, 3011 {"register", LG_register},
3000 {"set_singlethreaded", LG_set_singlethreaded}, 3012 {"set_singlethreaded", LG_set_singlethreaded},