# osal\_mutex.h - [Overview](#section247873507165628) - [Summary](#section287799635165628) - [Data Structures](#nested-classes) - [Macros](#define-members) - [Functions](#func-members) ## **Overview** **Related Modules:** [OSAL](OSAL.md) **Description:** Declares mutex types and interfaces. This file provides interfaces for initializing and destroying a mutex, locking a mutex, locking a mutex upon timeout, and unlocking a mutex. The mutex must be destroyed after being used. **Since:** 1.0 **Version:** 1.0 ## **Summary** ## Data Structures

Data Structure Name

Description

OsalMutex

Describes a mutex.

## Macros

Macro Name and Value

Description

OSAL_DECLARE_MUTEX(mutex) struct OsalMutex mutex

Defines a mutex.

## Functions

Function

Description

OsalMutexInit (struct OsalMutex *mutex)

int32_t

Initializes a mutex.

OsalMutexDestroy (struct OsalMutex *mutex)

int32_t

Destroys a mutex.

OsalMutexLock (struct OsalMutex *mutex)

int32_t

Locks a mutex.

OsalMutexTimedLock (struct OsalMutex *mutex, uint32_t ms)

int32_t

Locks a mutex with a specified timeout duration.

OsalMutexUnlock (struct OsalMutex *mutex)

int32_t

Unlocks a mutex.