summaryrefslogtreecommitdiff
path: root/indra/newview/scripts/lua/WaitQueue.lua
diff options
context:
space:
mode:
authornat-goodspeed <nat@lindenlab.com>2024-04-03 14:08:01 -0400
committerGitHub <noreply@github.com>2024-04-03 14:08:01 -0400
commitf069543328efc441673db9877c97ae2201b86e91 (patch)
tree299591b4bce2a1d6a5351d63b3ae249a130a5871 /indra/newview/scripts/lua/WaitQueue.lua
parentb4d699764044301c460560f7665b623a571bf14f (diff)
parent3f876a6a1d138c31266afb6c39df7090e304efe3 (diff)
Merge pull request #1110 from secondlife/lua-startup
Add `startup.lua` module with `startup.ensure()`, `startup.wait()` functions.
Diffstat (limited to 'indra/newview/scripts/lua/WaitQueue.lua')
-rw-r--r--indra/newview/scripts/lua/WaitQueue.lua11
1 files changed, 6 insertions, 5 deletions
diff --git a/indra/newview/scripts/lua/WaitQueue.lua b/indra/newview/scripts/lua/WaitQueue.lua
index 1fbcc50847..ad4fdecf43 100644
--- a/indra/newview/scripts/lua/WaitQueue.lua
+++ b/indra/newview/scripts/lua/WaitQueue.lua
@@ -5,8 +5,8 @@
local fiber = require('fiber')
local Queue = require('Queue')
--- local debug = LL.print_debug
-local function debug(...) end
+-- local dbg = require('printf')
+local function dbg(...) end
local WaitQueue = Queue:new()
@@ -60,17 +60,18 @@ function WaitQueue:Dequeue()
-- the queue while there are still items left, and we want the
-- consumer(s) to retrieve those last few items.
if self._closed then
- debug('WaitQueue:Dequeue(): closed')
+ dbg('WaitQueue:Dequeue(): closed')
return nil
end
- debug('WaitQueue:Dequeue(): waiting')
+ dbg('WaitQueue:Dequeue(): waiting')
-- add the running coroutine to the list of waiters
+ dbg('WaitQueue:Dequeue() running %s', tostring(coroutine.running() or 'main'))
table.insert(self._waiters, fiber.running())
-- then let somebody else run
fiber.wait()
end
-- here we're sure this queue isn't empty
- debug('WaitQueue:Dequeue() calling Queue.Dequeue()')
+ dbg('WaitQueue:Dequeue() calling Queue.Dequeue()')
return Queue.Dequeue(self)
end