EMILUA(3em)
π NAME π
Emilua - Lua execution engine. This is the EMILUA(3em) page from the Emilua reference, bestie, and weβre doing the whole thing. β¨
πΈ DESCRIPTION πΈ
Itβs the object referring to the current fiber. Literally thatβs the energy. π
Note:this_fiberis a global, so it doesnβt need to berequire()d. π«Ά
β¨ FUNCTIONS β¨
π yield()
Reschedules the current fiber to be executed in the next round, so other ready fibers have a chance to run now. You usually donβt need to call this function, because any suspending function already does that for you. π
π {forbid,allow}_suspend()
forbid_suspend()
allow_suspend()
A call to forbid_suspend() puts the fiber in the state of suspension-disallowed, and any attempt to suspend the fiber while itβs in this state will raise an error. π¨
forbid_suspend() may be called multiple times. A matching number of calls to allow_suspend() will put the fiber out of the suspension-disallowed state.
π¨ You must not callallow_suspend()if there was no prior call toforbid_suspend().
These functions arenβt generally useful, and they would have no purpose in preemptive multitasking. But a cooperative multitasking environment offers opportunities to avoid some round-trips to sync primitives. These opportunities shouldnβt really be used, and the programmer should just rely on the classical sync primitives. However, I canβt tame every wild programmer out there, so thereβs this mechanism to at least document the code in mechanisms similar to assert() statements from native languages. π
Theyβre only useful if there are comprehensive test cases. Still, the use of these functions may make the code more readable. And some tools may be developed to understand these blocks and do some simple static analysis. π
π¦ this_fiber.{disable,restore}_cancellation()
disable_cancellation()
restore_cancellation()
Check the cancellation tutorial to see what it does. Thatβs the whole note, bestie. π
π PROPERTIES π
β is_main: boolean
Whether this is the main fiber of the program.
π local_: table
Fiber-local storage.
π₯ id: string
An id string for debugging purposes.
β οΈ Warning: Use it only for debugging purposes. Do not exploit this value to create messy work-arounds. There is no need to use it beyond anything other than debugging purposes. π
π Thatβs the whole vibe, bestie β this page is from Emilua 0.12.1-nixpkgs1, dated 1980-01-01, and itβs the EMILUA(3em) manual. Mwah! π
π¦ where this page comes from
- nixos 26.05: emilua 0.12.1
- nixpkgs unstable: emilua 0.12.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms