summaryrefslogtreecommitdiff
path: root/indra/newview/scripts/lua
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-07-10 15:17:58 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-07-10 15:17:58 -0400
commitb032abe2074949074c893153d992ae264c34116a (patch)
tree9b7c65188ab4abcb7aa6f022438d3b7885c9e834 /indra/newview/scripts/lua
parent8c94ff566a4f9076607d1b988f3eb7ad7e200bd9 (diff)
parente26727e03bb02d26b3f0d83f748dbd8eb88e4940 (diff)
Merge branch 'lua-atexit-run' into lua-no-reuse.
We couldn't discard the "p.s." fiber.run() call from LuaState::expr() until we could count on fiber.lua's LL.atexit(fiber.run) call being executed after each Lua script or chunk, and we couldn't count on that until we made LLLUAmanager::runScriptFile() instantiate and destroy its LuaState on the C++ Lua-specific coroutine. Now that we've done that, use LL.atexit(fiber.run) instead of the whole special-case "p.s." in LuaState::expr().
Diffstat (limited to 'indra/newview/scripts/lua')
-rw-r--r--indra/newview/scripts/lua/require/fiber.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/indra/newview/scripts/lua/require/fiber.lua b/indra/newview/scripts/lua/require/fiber.lua
index cae27b936b..b3c684dd67 100644
--- a/indra/newview/scripts/lua/require/fiber.lua
+++ b/indra/newview/scripts/lua/require/fiber.lua
@@ -337,4 +337,10 @@ function fiber.run()
return idle_done
end
+-- Make sure we finish up with a call to run(). That allows a consuming script
+-- to kick off some number of fibers, do some work on the main thread and then
+-- fall off the end of the script without explicitly calling fiber.run().
+-- run() ensures the rest of the fibers run to completion (or error).
+LL.atexit(fiber.run)
+
return fiber