Skip to content
SinisterRectus edited this page Nov 16, 2019 · 7 revisions

Mutual exclusion class used to control Lua coroutine execution order.

Constructor

Mutex()

Methods

lock(prepend)

Parameter Type Optional
prepend boolean

If the mutex is not active (if a coroutine is not queued), this will activate the mutex; otherwise, this will yield and queue the current coroutine.

This method only operates on data in memory.

Returns: nil


unlock()

If the mutex is active (if a coroutine is queued), this will dequeue and resume the next available coroutine; otherwise, this will deactivate the mutex.

This method only operates on data in memory.

Returns: nil


unlockAfter(delay)

Parameter Type
delay number

Asynchronously unlocks the mutex after a specified time in milliseconds. The relevant uv_timer object is returned.

This method only operates on data in memory.

Returns: uv_timer


Clone this wiki locally