Skip to content

Read/Write Locks

Functions

Name
int wc_InitRwLock(wolfSSL_RwLock * m)
Initializes read-write lock.
int wc_FreeRwLock(wolfSSL_RwLock * m)
Frees read-write lock resources.
int wc_LockRwLock_Wr(wolfSSL_RwLock * m)
Locks read-write lock for writing.
int wc_LockRwLock_Rd(wolfSSL_RwLock * m)
Locks read-write lock for reading.
int wc_UnLockRwLock(wolfSSL_RwLock * m)
Unlocks read-write lock.

Functions Documentation

function wc_InitRwLock

int wc_InitRwLock(
    wolfSSL_RwLock * m
)

Initializes read-write lock.

Parameters:

  • m Read-write lock pointer

See: wc_FreeRwLock

Return:

  • 0 on success
  • negative on error

Example

wolfSSL_RwLock lock;
int ret = wc_InitRwLock(&lock);

function wc_FreeRwLock

int wc_FreeRwLock(
    wolfSSL_RwLock * m
)

Frees read-write lock resources.

Parameters:

  • m Read-write lock pointer

See: wc_InitRwLock

Return:

  • 0 on success
  • negative on error

Example

wolfSSL_RwLock lock;
wc_InitRwLock(&lock);
int ret = wc_FreeRwLock(&lock);

function wc_LockRwLock_Wr

int wc_LockRwLock_Wr(
    wolfSSL_RwLock * m
)

Locks read-write lock for writing.

Parameters:

  • m Read-write lock pointer

See: wc_UnLockRwLock

Return:

  • 0 on success
  • negative on error

Example

wolfSSL_RwLock lock;
int ret = wc_LockRwLock_Wr(&lock);

function wc_LockRwLock_Rd

int wc_LockRwLock_Rd(
    wolfSSL_RwLock * m
)

Locks read-write lock for reading.

Parameters:

  • m Read-write lock pointer

See: wc_UnLockRwLock

Return:

  • 0 on success
  • negative on error

Example

wolfSSL_RwLock lock;
int ret = wc_LockRwLock_Rd(&lock);

function wc_UnLockRwLock

int wc_UnLockRwLock(
    wolfSSL_RwLock * m
)

Unlocks read-write lock.

Parameters:

  • m Read-write lock pointer

See: wc_LockRwLock_Rd

Return:

  • 0 on success
  • negative on error

Example

wolfSSL_RwLock lock;
wc_LockRwLock_Rd(&lock);
int ret = wc_UnLockRwLock(&lock);

Updated on 2026-11-17 at 01:15:29 +0000