aboutsummaryrefslogtreecommitdiff
path: root/src/lanes.c
diff options
context:
space:
mode:
authorBenoit Germain <bnt.germain@gmail.com>2018-11-09 17:36:35 +0100
committerBenoit Germain <bnt.germain@gmail.com>2018-11-09 17:36:35 +0100
commita3ec8e0b6b5cc88063893fd7226599727a41dd29 (patch)
tree8b7f5304b55a49c60bf0f1b4b540143373e00c42 /src/lanes.c
parentb899b53286e9125f34fd7522f4a173ff12643b68 (diff)
downloadlanes-a3ec8e0b6b5cc88063893fd7226599727a41dd29.tar.gz
lanes-a3ec8e0b6b5cc88063893fd7226599727a41dd29.tar.bz2
lanes-a3ec8e0b6b5cc88063893fd7226599727a41dd29.zip
new API lanes.set_thread_affinity(), and et_debug_threadname implemented with win32 pthread
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},