Developer World
Spresense SDK Library v3.2.0-ebc0364
Functions
Collaboration diagram for Functions:

Functions

int mpmutex_init (mpmutex_t *mutex, key_t key)
 
int mpmutex_destroy (mpmutex_t *mutex)
 
int mpmutex_lock (mpmutex_t *mutex)
 
int mpmutex_trylock (mpmutex_t *mutex)
 
int mpmutex_unlock (mpmutex_t *mutex)
 

Detailed Description

Function Documentation

◆ mpmutex_init()

int mpmutex_init ( mpmutex_t mutex,
key_t  key 
)

Initialize MP mutex

Parameters
[in,out]mutexMP mutex object
[in]keyUnique object ID
Returns
On success, mpmutex_init() returns 0. On error, it returns an error number.
Return values
-EINVALInvalild argument
-ENOENTNo allocate mutex

◆ mpmutex_destroy()

int mpmutex_destroy ( mpmutex_t mutex)

Destroy MP mutex

Parameters
[in,out]mutexMP mutex object
Returns
On success, mpmutex_destroy() returns 0. On error, it returns an error number.
Return values
-EINVALInvalid argument

◆ mpmutex_lock()

int mpmutex_lock ( mpmutex_t mutex)

Lock MP mutex

mpmutex_lock() is lock specified mutex. If mutex is already locked, then mpmutex_lock() waits for it to be unlocked by locker.

Parameters
[in,out]mutexMP mutex object
Returns
On success, mpmutex_lock() returns 0. On error, it returns an error number.
Return values
-EINVALInvalid argument

◆ mpmutex_trylock()

int mpmutex_trylock ( mpmutex_t mutex)

Try to lock MP mutex

mpmutex_trylock() is try to lock specified mutex. If mutex is already locked, then return -EBUSY.

Parameters
[in,out]mutexMP mutex object
Returns
On success, mpmutex_trylock() returns 0. On error, it returns an error number.
Return values
-EINVALInvalid argument
-EBUSYMutex is locked

◆ mpmutex_unlock()

int mpmutex_unlock ( mpmutex_t mutex)

Unlock MP mutex

Parameters
[in,out]mutexMP mutex object
Returns
On success, mpmutex_unlock() returns 0. On error, it returns an error number.
Return values
-EINVALInvalid argument