EMILUA(3em)

πŸ“¦ version 0.12.1, in nixos 26.05, nixpkgs unstable

πŸ’– EMILUA πŸ’–

okay bestie, this is the 3em manual page for Emilua, from the Emilua reference β€” the Lua execution engine. buckle up, it’s giving iconic πŸ’…βœ¨


🌸 NAME 🌸

Emilua - Lua execution engine πŸŽ€


✨ DESCRIPTION ✨

the DESCRIPTION section opens with this whole code block, so here it is exactly as it appears:

local mutex = require('mutex')

local function ping_sender()
    sleep(30)
    scope(function()
        scope_cleanup_push(function() ws_write_mtx:unlock() end)
        ws_write_mtx:lock()
        ws:ping()
    end)
end

local function queue_consumer()
    scope(function()
        scope_cleanup_push(function() queue_mtx:unlock() end)
        queue_mtx:lock()
        while #queue == 0 do
            queue_cond:wait(queue_mtx)
        end
        for _, e in ipairs(queue) do
            consume_item(e)
        end
        queue = {}
    end)
end

and after all that, the description lands on: A mutex. πŸ’…


πŸ’… FUNCTIONS πŸ’…

πŸŽ€ new() β†’ mutex πŸŽ€

constructor time, bestie. πŸ’–

πŸ”’ lock(self) πŸ”’

locks the mutex. no cap.

Note β€” this suspending function does not act as an cancellation point. 😌
Note β€” this mutex applies dispatch semantics: if it’s possible to acquire the mutex immediately, there will be no context switch to other ready fibers. πŸ¦‹

πŸ‘€ try_lock(self) β†’ boolean πŸ‘€

tries to lock the mutex and hands back a boolean saying whether the lock acquisition was successful. ✨

Caution β€” it’s an error to call try_lock() if the current fiber already owns the mutex (cf. recursive_mutex(3em) for an alternative). πŸ™ˆ
Note β€” the current fiber is never suspended. πŸ’€

πŸ”“ unlock(self) πŸ”“

unlocks the mutex. periodt. 🫢


source/version: Emilua 0.12.1-nixpkgs1 Β· date: 1980-01-01 Β· manual: EMILUA(3em) β€” that’s the whole page, bestie πŸ’…βœ¨

πŸ“¦ where this page comes from