EMILUA(3em)

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

πŸŽ€ 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_fiber is a global, so it doesn’t need to be require()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 call allow_suspend() if there was no prior call to forbid_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