Mutex

Inherits: Reference < Object

Category: Core

Brief Description

A synchronization Mutex.

Methods

void lock ( )
Error try_lock ( )
void unlock ( )

Description

A synchronization Mutex. Element used to synchronize multiple Threads. Basically a binary Semaphore. Guarantees that only one thread can ever acquire this lock at a time. Can be used to protect a critical section. Be careful to avoid deadlocks.

Method Descriptions

  • void lock ( )

Lock this Mutex, blocks until it is unlocked by the current owner.


Try locking this Mutex, does not block. Returns @GlobalScope.OK on success, @GlobalScope.ERR_BUSY otherwise.


  • void unlock ( )

Unlock this Mutex, leaving it to other threads.