diff options
Diffstat (limited to 'src/lanes.cpp')
-rw-r--r-- | src/lanes.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/lanes.cpp b/src/lanes.cpp index 9fc7fc9..b74e9ec 100644 --- a/src/lanes.cpp +++ b/src/lanes.cpp | |||
@@ -143,7 +143,7 @@ LUAG_FUNC(set_thread_priority) | |||
143 | if (_prio < kThreadPrioMin || _prio > kThreadPrioMax) { | 143 | if (_prio < kThreadPrioMin || _prio > kThreadPrioMax) { |
144 | raise_luaL_error(L_, "priority out of range: %d..+%d (%d)", kThreadPrioMin, kThreadPrioMax, _prio); | 144 | raise_luaL_error(L_, "priority out of range: %d..+%d (%d)", kThreadPrioMin, kThreadPrioMax, _prio); |
145 | } | 145 | } |
146 | THREAD_SET_PRIORITY(static_cast<int>(_prio), universe_get(L_)->sudo); | 146 | THREAD_SET_PRIORITY(static_cast<int>(_prio), Universe::Get(L_)->sudo); |
147 | return 0; | 147 | return 0; |
148 | } | 148 | } |
149 | 149 | ||
@@ -169,7 +169,7 @@ LUAG_FUNC(require) | |||
169 | { | 169 | { |
170 | std::string_view const _name{ lua_tostringview(L_, 1) }; // L_: "name" ... | 170 | std::string_view const _name{ lua_tostringview(L_, 1) }; // L_: "name" ... |
171 | int const _nargs{ lua_gettop(L_) }; | 171 | int const _nargs{ lua_gettop(L_) }; |
172 | DEBUGSPEW_CODE(Universe * _U{ universe_get(L_) }); | 172 | DEBUGSPEW_CODE(Universe * _U{ Universe::Get(L_) }); |
173 | STACK_CHECK_START_REL(L_, 0); | 173 | STACK_CHECK_START_REL(L_, 0); |
174 | DEBUGSPEW_CODE(DebugSpew(_U) << "lanes.require '" << _name << "' BEGIN" << std::endl); | 174 | DEBUGSPEW_CODE(DebugSpew(_U) << "lanes.require '" << _name << "' BEGIN" << std::endl); |
175 | DEBUGSPEW_CODE(DebugSpewIndentScope _scope{ _U }); | 175 | DEBUGSPEW_CODE(DebugSpewIndentScope _scope{ _U }); |
@@ -194,7 +194,7 @@ LUAG_FUNC(register) | |||
194 | // ignore extra parameters, just in case | 194 | // ignore extra parameters, just in case |
195 | lua_settop(L_, 2); | 195 | lua_settop(L_, 2); |
196 | luaL_argcheck(L_, (_mod_type == LuaType::TABLE) || (_mod_type == LuaType::FUNCTION), 2, "unexpected module type"); | 196 | luaL_argcheck(L_, (_mod_type == LuaType::TABLE) || (_mod_type == LuaType::FUNCTION), 2, "unexpected module type"); |
197 | DEBUGSPEW_CODE(Universe* _U = universe_get(L_)); | 197 | DEBUGSPEW_CODE(Universe* _U = Universe::Get(L_)); |
198 | STACK_CHECK_START_REL(L_, 0); // "name" mod_table | 198 | STACK_CHECK_START_REL(L_, 0); // "name" mod_table |
199 | DEBUGSPEW_CODE(DebugSpew(_U) << "lanes.register '" << _name << "' BEGIN" << std::endl); | 199 | DEBUGSPEW_CODE(DebugSpew(_U) << "lanes.register '" << _name << "' BEGIN" << std::endl); |
200 | DEBUGSPEW_CODE(DebugSpewIndentScope _scope{ _U }); | 200 | DEBUGSPEW_CODE(DebugSpewIndentScope _scope{ _U }); |
@@ -236,7 +236,7 @@ LUAG_FUNC(lane_new) | |||
236 | int const _nargs{ lua_gettop(L_) - kFixedArgsIdx }; | 236 | int const _nargs{ lua_gettop(L_) - kFixedArgsIdx }; |
237 | LUA_ASSERT(L_, _nargs >= 0); | 237 | LUA_ASSERT(L_, _nargs >= 0); |
238 | 238 | ||
239 | Universe* const _U{ universe_get(L_) }; | 239 | Universe* const _U{ Universe::Get(L_) }; |
240 | DEBUGSPEW_CODE(DebugSpew(_U) << "lane_new: setup" << std::endl); | 240 | DEBUGSPEW_CODE(DebugSpew(_U) << "lane_new: setup" << std::endl); |
241 | 241 | ||
242 | std::optional<std::string_view> _libs_str{ lua_isnil(L_, kLibsIdx) ? std::nullopt : std::make_optional(lua_tostringview(L_, kLibsIdx)) }; | 242 | std::optional<std::string_view> _libs_str{ lua_isnil(L_, kLibsIdx) ? std::nullopt : std::make_optional(lua_tostringview(L_, kLibsIdx)) }; |
@@ -510,7 +510,7 @@ LUAG_FUNC(lane_new) | |||
510 | // Return a list of all known lanes | 510 | // Return a list of all known lanes |
511 | LUAG_FUNC(threads) | 511 | LUAG_FUNC(threads) |
512 | { | 512 | { |
513 | LaneTracker const& _tracker = universe_get(L_)->tracker; | 513 | LaneTracker const& _tracker = Universe::Get(L_)->tracker; |
514 | return _tracker.pushThreadsTable(L_); | 514 | return _tracker.pushThreadsTable(L_); |
515 | } | 515 | } |
516 | 516 | ||
@@ -616,7 +616,7 @@ LUAG_FUNC(configure) | |||
616 | // start with one-time initializations. | 616 | // start with one-time initializations. |
617 | { | 617 | { |
618 | // C++ guarantees that the static variable initialization is threadsafe. | 618 | // C++ guarantees that the static variable initialization is threadsafe. |
619 | static auto _ = std::invoke( | 619 | [[maybe_unused]] static auto _ = std::invoke( |
620 | []() { | 620 | []() { |
621 | #if (defined PLATFORM_OSX) && (defined _UTILBINDTHREADTOCPU) | 621 | #if (defined PLATFORM_OSX) && (defined _UTILBINDTHREADTOCPU) |
622 | chudInitialize(); | 622 | chudInitialize(); |
@@ -625,7 +625,7 @@ LUAG_FUNC(configure) | |||
625 | }); | 625 | }); |
626 | } | 626 | } |
627 | 627 | ||
628 | Universe* _U{ universe_get(L_) }; | 628 | Universe* _U{ Universe::Get(L_) }; |
629 | bool const _from_master_state{ _U == nullptr }; | 629 | bool const _from_master_state{ _U == nullptr }; |
630 | std::string_view const _name{ luaL_checkstringview(L_, lua_upvalueindex(1)) }; | 630 | std::string_view const _name{ luaL_checkstringview(L_, lua_upvalueindex(1)) }; |
631 | LUA_ASSERT(L_, lua_type(L_, 1) == LUA_TTABLE); | 631 | LUA_ASSERT(L_, lua_type(L_, 1) == LUA_TTABLE); |
@@ -637,12 +637,12 @@ LUAG_FUNC(configure) | |||
637 | DEBUGSPEW_CODE(DebugSpewIndentScope _scope{ _U }); | 637 | DEBUGSPEW_CODE(DebugSpewIndentScope _scope{ _U }); |
638 | 638 | ||
639 | if (_U == nullptr) { | 639 | if (_U == nullptr) { |
640 | _U = universe_create(L_); // L_: settings universe | 640 | _U = Universe::Create(L_); // L_: settings universe |
641 | DEBUGSPEW_CODE(DebugSpewIndentScope _scope2{ _U }); | 641 | DEBUGSPEW_CODE(DebugSpewIndentScope _scope2{ _U }); |
642 | lua_createtable(L_, 0, 1); // L_: settings universe {mt} | 642 | lua_createtable(L_, 0, 1); // L_: settings universe {mt} |
643 | std::ignore = luaG_getfield(L_, 1, "shutdown_timeout"); // L_: settings universe {mt} shutdown_timeout | 643 | std::ignore = luaG_getfield(L_, 1, "shutdown_timeout"); // L_: settings universe {mt} shutdown_timeout |
644 | std::ignore = luaG_getfield(L_, 1, "shutdown_mode"); // L_: settings universe {mt} shutdown_timeout shutdown_mode | 644 | std::ignore = luaG_getfield(L_, 1, "shutdown_mode"); // L_: settings universe {mt} shutdown_timeout shutdown_mode |
645 | lua_pushcclosure(L_, universe_gc, 2); // L_: settings universe {mt} universe_gc | 645 | lua_pushcclosure(L_, LG_universe_gc, 2); // L_: settings universe {mt} LG_universe_gc |
646 | lua_setfield(L_, -2, "__gc"); // L_: settings universe {mt} | 646 | lua_setfield(L_, -2, "__gc"); // L_: settings universe {mt} |
647 | lua_setmetatable(L_, -2); // L_: settings universe | 647 | lua_setmetatable(L_, -2); // L_: settings universe |
648 | lua_pop(L_, 1); // L_: settings | 648 | lua_pop(L_, 1); // L_: settings |