WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
osal_mutex

函数

int osal_mutex_init (osal_mutex *mutex)
 Initialize the mutex.
 
int osal_mutex_lock (osal_mutex *mutex)
 Acquire the mutex.
 
int osal_mutex_lock_timeout (osal_mutex *mutex, unsigned int timeout)
 Acquire the mutex until timeout.
 
int osal_mutex_lock_interruptible (osal_mutex *mutex)
 Acquire the mutex until timeout, interruptible by signals.
 
int osal_mutex_trylock (osal_mutex *mutex)
 Try to acquire the mutex.
 
void osal_mutex_unlock (osal_mutex *mutex)
 Release the mutex.
 
int osal_mutex_is_locked (osal_mutex *mutex)
 is the mutex locked.
 
void osal_mutex_destroy (osal_mutex *mutex)
 Destroy the mutex.
 

详细描述

函数说明

◆ osal_mutex_destroy()

void osal_mutex_destroy ( osal_mutex mutex)

Destroy the mutex.

Description:
This API is used to destroy the mutex.
参数
mutex[in] The mutex to be destroyed.
注意
must be called when kmod exit, otherwise will lead to memory leak; osal_mutex_destroy will free memory, caller should clear pointer to be NULL after called.
Support System:
linux liteos freertos.

◆ osal_mutex_init()

int osal_mutex_init ( osal_mutex mutex)

Initialize the mutex.

Description:
This API is used to initialize the mutex.
参数
mutex[in] the mutex to be initialized.
返回
OSAL_FAILURE/OSAL_SUCCESS
Support System:
linux liteos freertos.

◆ osal_mutex_is_locked()

int osal_mutex_is_locked ( osal_mutex mutex)

is the mutex locked.

Description:
is the mutex locked.
参数
mutex[in] The mutex to be acquired.
返回
true if the mutex is locked, false if unlocked.
Support System:
linux freertos.

◆ osal_mutex_lock()

int osal_mutex_lock ( osal_mutex mutex)

Acquire the mutex.

Description:
Acquire the mutex. Lock the mutex exclusively for this task. If the mutex is not available right now, it will sleep until it can get it.
参数
mutex[in] the mutex to be initialized.
返回
OSAL_FAILURE/OSAL_SUCCESS
注解
The mutex must later on be released by the same task that acquired it. Recursive locking is not allowed. The task may not exit without first unlocking the mutex. Also, kernel memory where the mutex resides must not be freed with the mutex still locked. The mutex must first be initialized (or statically defined) before it can be locked. memset()-ing the mutex to 0 is not allowed.
Support System:
linux liteos freertos.
System Differ:LiteOS and Freertos supports the nested lock feature.

◆ osal_mutex_lock_interruptible()

int osal_mutex_lock_interruptible ( osal_mutex mutex)

Acquire the mutex until timeout, interruptible by signals.

Description:
Acquire the mutex, interruptible by signals. Lock the mutex like mutex_lock(). If a signal is delivered while the process is sleeping, this function will return without acquiring the mutex.
参数
mutex[in] The mutex to be acquired.
返回
OSAL_FAILURE/OSAL_SUCCESS/OSAL_EINTR
Support System:
linux liteos.
System Differ: Only LiteOS supports the nested lock feature.

◆ osal_mutex_lock_timeout()

int osal_mutex_lock_timeout ( osal_mutex mutex,
unsigned int  timeout 
)

Acquire the mutex until timeout.

Description:
This API is used to wait for a specified period of time to acquire the mutex.
参数
mutex[in] The mutex to be acquired.
timeout[in] how long to wait before failing.
返回
OSAL_FAILURE/OSAL_SUCCESS
Support System:
liteos freertos.
System Differ: LiteOS and Freertos supports the nested lock feature.

◆ osal_mutex_trylock()

int osal_mutex_trylock ( osal_mutex mutex)

Try to acquire the mutex.

Description:
try to acquire the mutex, without waiting.
参数
mutex[in] The mutex to be acquired.
返回
TRUE/FALSE
Support System:
linux liteos freertos.
System Differ: LiteOS and Freertos supports the nested lock feature.

◆ osal_mutex_unlock()

void osal_mutex_unlock ( osal_mutex mutex)

Release the mutex.

Description:
Release the mutex. Unlock a mutex that has been locked by this task previously. This function must not be used in interrupt context. Unlocking of a not locked mutex is not allowed.
参数
mutex[in] the mutex to be released.
Support System:
linux liteos freertos.