mint.lockguard - Palamecia/mint GitHub Wiki

Module

load mint.lockguard

This module provides the LockGuard class which allow to perform a scoped System.Mutex lock.

Classes

LockGuard

This class provides a scoped lock mecanisme. It allows to ensure that the System.Mutex lock is released after a function call.

Example:

def thread_safe_operation(mutex) {
    lock = LockGuard(mutex)
    // Performe critical operation
}

[!NOTE] The lock can also be released by deleting the object.

Public members

Modifiers Member Description
const delete Releases the lock when the object is deleted.
const new Creates a new lock on the mutex.

Private members

Modifiers Member Description
final mutex Internal mutex.

Descriptions

LockGuard.delete

def (self)

Releases the lock when the object is deleted.

LockGuard.mutex

null

Internal mutex.

LockGuard.new

def (self, mutex)

Creates a new lock on the mutex.