GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
EMILUA(3em) Emilua reference EMILUA(3em)

Emilua - Lua execution engine

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

A mutex.

new() → mutex

Constructor.

lock(self)

Locks the mutex.


Note

This suspending function does not act as an cancellation point.


Note

This mutex applies dispatch semantics. That means no context switch to
other ready fibers will take place if it’s possible to acquire the mutex immediately.

try_lock(self) → boolean

Tries to lock the mutex. Returns whether lock acquisition was successful.


Caution

It’s an error to call try_lock() if 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.

2025-04-19 Emilua 0.11.5

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.