dnsjit.core.thread(3)
π dnsjit.core.thread β POSIX thread with separate Lua state π
okay bestie, welcome to dnsjit.core.thread(3) from the Library Functions Manual π this one is lowkey iconic: it's a whole POSIX thread with its own Lua state. separate vibes, separate brain, same process. let's get into it β¨
β¨ SYNOPSIS β¨
local thr = require("dnsjit.core.thread").new()
thr:start(function(thr)
print("Hello from thread")
print("got:", thr:pop(), " = ", thr:pop(3))
end)
thr:push("value from main", 1, 2, 3)
thr:stop()
πΈ DESCRIPTION πΈ
So here's the tea: you spin up a brand new POSIX thread, and it gets its own Lua state. Completely its own. No sharing, no crossover, no messy entanglement π
Sharable objects can travel over to the thread by pushing them and poping them off the thread stack β it's giving very "passing notes in class" energy, except the notes are objects π«Ά
β οΈ okay important, listen: the Thread object and any other objects passed to the thread need to be kept alive for as long as the thread is running. no cap. keep them alive or things get weird π
π§ Functions
Thread.new()
Create a new Thread object. fresh, sparkly, ready to go β¨
Thread:log()
Return the Log object so you can control logging for this instance or this module. yep, it's your little logging remote control π
Thread:start(func)
Start the thread and run the given func in a separate Lua state. the first argument handed to that function is the Thread object that created it. returns 0 on success π
Thread:stop()
Wait for the thread to return. returns 0 on success π
Thread:push(...)
Push string(s), number(s), or sharable object(s) onto the thread stack so they can be picked back up inside the thread with pop(). strings and numbers get copied, but the sharable object(s) need to be kept alive as long as the thread is running β yes, again, this is the rule, iykyk π
Thread:pop(num)
Pop value(s) off the thread stack. should only be called from inside the thread, bestie, don't try it from outside π If num isn't given, then exactly one value gets poped. Returns nil if there are no values left on the stack.
π SEE ALSO π
π AUTHORS and CONTRIBUTORS π
Jerry LundstrΓΆm (DNS-OARC), TomΓ‘Ε‘ KΕΓΕΎek (CZ.NIC), Petr Ε paΔek (ISC)
Maintained by DNS-OARC
https://www.dns-oarc.net/
π BUGS π
Got issues? Got feature requests? Please use:
https://codeberg.org/DNS-OARC/dnsjit/issues
Got questions? Need help? Please use:
admin@dns-oarc.net
and that's the whole page, bestie π«Ά this was dnsjit.core.thread(3) β dnsjit version 1.5.1, dropped as part of the dnsjit manual set. slay, go forth and thread responsibly πβ¨π
π¦ where this page comes from
- epel 10: dnsjit 1.5.1-2.el10_2 Β· GPL-3.0-or-later
- epel 9: dnsjit 1.5.1-2.el9 Β· GPL-3.0-or-later
- fedora 43: dnsjit 1.5.1-2.fc43 Β· GPL-3.0-or-later
- fedora 43: dnsjit 1.5.1-2.fc43 Β· GPL-3.0-or-later
- fedora 44: dnsjit 1.5.1-2.fc44 Β· GPL-3.0-or-later
- fedora 44: dnsjit 1.5.1-2.fc44 Β· GPL-3.0-or-later
- ubuntu resolute: dnsjit 1.5.1-2 Β· GPL-3.0-or-later
- ubuntu stonking: dnsjit-dev 1.5.1-6 Β· GPL-3.0-or-later
- Copyright (c) 2018-2026 OARC, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms