summaryrefslogtreecommitdiff
path: root/indra/newview/scripts/lua/require
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-06-18 13:13:39 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-06-18 13:13:39 -0400
commite26727e03bb02d26b3f0d83f748dbd8eb88e4940 (patch)
tree22f0592fde6ef683f251b50d0e93adf5bef9f204 /indra/newview/scripts/lua/require
parent5cc4b42a3001be120e22f745460dbb76d8d8d018 (diff)
Remove special-case ~LuaState() code to call fiber.run().
Instead, make fiber.lua call LL.atexit(fiber.run) to schedule that final run() call at ~LuaState() time using the generic mechanism. Append an explicit fiber.run() call to a specific test in llluamanager_test.cpp because the test code wants to interact with multiple Lua fibers *before* we destroy the LuaState.
Diffstat (limited to 'indra/newview/scripts/lua/require')
-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