Mutexes
Functions
| Name | |
|---|---|
| int | wc_InitMutex(wolfSSL_Mutex * m) Initializes mutex. |
| int | wc_FreeMutex(wolfSSL_Mutex * m) Frees mutex resources. |
| int | wc_LockMutex(wolfSSL_Mutex * m) Locks mutex. |
| int | wc_UnLockMutex(wolfSSL_Mutex * m) Unlocks mutex. |
| wolfSSL_Mutex * | wc_InitAndAllocMutex(void ) Initializes and allocates mutex. |
| int | wc_LockMutex_ex(int flag, int type, const char * file, int line) Locks mutex with debug info. |
| int | wc_SetMutexCb(mutex_cb * cb) Sets mutex callback. |
| mutex_cb * | wc_GetMutexCb(void ) Gets mutex callback. |
Functions Documentation
function wc_InitMutex
int wc_InitMutex(
wolfSSL_Mutex * m
)
Initializes mutex.
Parameters:
- m Mutex pointer
See: wc_FreeMutex
Return:
- 0 on success
- negative on error
Example
wolfSSL_Mutex mutex;
int ret = wc_InitMutex(&mutex);
function wc_FreeMutex
int wc_FreeMutex(
wolfSSL_Mutex * m
)
Frees mutex resources.
Parameters:
- m Mutex pointer
See: wc_InitMutex
Return:
- 0 on success
- negative on error
Example
wolfSSL_Mutex mutex;
wc_InitMutex(&mutex);
int ret = wc_FreeMutex(&mutex);
function wc_LockMutex
int wc_LockMutex(
wolfSSL_Mutex * m
)
Locks mutex.
Parameters:
- m Mutex pointer
See: wc_UnLockMutex
Return:
- 0 on success
- negative on error
Example
wolfSSL_Mutex mutex;
int ret = wc_LockMutex(&mutex);
function wc_UnLockMutex
int wc_UnLockMutex(
wolfSSL_Mutex * m
)
Unlocks mutex.
Parameters:
- m Mutex pointer
See: wc_LockMutex
Return:
- 0 on success
- negative on error
Example
wolfSSL_Mutex mutex;
wc_LockMutex(&mutex);
int ret = wc_UnLockMutex(&mutex);
function wc_InitAndAllocMutex
wolfSSL_Mutex * wc_InitAndAllocMutex(
void
)
Initializes and allocates mutex.
Parameters:
- none No parameters
See: wc_InitMutex
Return:
- Pointer to mutex on success
- NULL on error
Example
wolfSSL_Mutex* mutex = wc_InitAndAllocMutex();
if (mutex != NULL) {
wc_LockMutex(mutex);
}
function wc_LockMutex_ex
int wc_LockMutex_ex(
int flag,
int type,
const char * file,
int line
)
Locks mutex with debug info.
Parameters:
- flag Lock flag
- type Lock type
- file Source file name
- line Source line number
See: wc_LockMutex
Return:
- 0 on success
- negative on error
Example
int ret = wc_LockMutex_ex(0, 0, __FILE__, __LINE__);
function wc_SetMutexCb
int wc_SetMutexCb(
mutex_cb * cb
)
Sets mutex callback.
Parameters:
- cb Mutex callback pointer
See: wc_GetMutexCb
Return:
- 0 on success
- negative on error
Example
mutex_cb cb;
int ret = wc_SetMutexCb(&cb);
function wc_GetMutexCb
mutex_cb * wc_GetMutexCb(
void
)
Gets mutex callback.
Parameters:
- none No parameters
See: wc_SetMutexCb
Return: Pointer to mutex callback
Example
mutex_cb* cb = wc_GetMutexCb();
Updated on 2026-11-17 at 01:15:29 +0000