Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of azure_c_shared_utility by
lock.h File Reference
A minimalistic platform agnostic lock abstraction for thread synchronization. More...
Go to the source code of this file.
Functions | |
| DEFINE_ENUM (LOCK_RESULT, LOCK_RESULT_VALUES) | |
| Enumeration specifying the lock status. | |
| MOCKABLE_FUNCTION (, LOCK_HANDLE, Lock_Init) | |
| This API creates and returns a valid lock handle. | |
| MOCKABLE_FUNCTION (, LOCK_RESULT, Lock, LOCK_HANDLE, handle) | |
| Acquires a lock on the given lock handle. | |
| MOCKABLE_FUNCTION (, LOCK_RESULT, Unlock, LOCK_HANDLE, handle) | |
| Releases the lock on the given lock handle. | |
| MOCKABLE_FUNCTION (, LOCK_RESULT, Lock_Deinit, LOCK_HANDLE, handle) | |
| The lock instance is destroyed. | |
Detailed Description
A minimalistic platform agnostic lock abstraction for thread synchronization.
The Lock component is implemented in order to achieve thread synchronization, as we may have a requirement to consume locks across different platforms. This component exposes some generic APIs so that it can be extended for platform specific implementations.
Definition in file lock.h.
Function Documentation
| DEFINE_ENUM | ( | LOCK_RESULT | , |
| LOCK_RESULT_VALUES | |||
| ) |
Enumeration specifying the lock status.
| MOCKABLE_FUNCTION | ( | LOCK_RESULT | , |
| Lock_Deinit | , | ||
| LOCK_HANDLE | , | ||
| handle | |||
| ) |
The lock instance is destroyed.
- Parameters:
-
handle A valid handle to the lock.
- Returns:
- Returns
LOCK_OKwhen the lock object has been destroyed andLOCK_ERRORwhen an error occurs.
| MOCKABLE_FUNCTION | ( | LOCK_RESULT | , |
| Unlock | , | ||
| LOCK_HANDLE | , | ||
| handle | |||
| ) |
Releases the lock on the given lock handle.
Uses platform specific mutex primitives in its implementation.
- Parameters:
-
handle A valid handle to the lock.
- Returns:
- Returns
LOCK_OKwhen the lock has been released andLOCK_ERRORwhen an error occurs.
| MOCKABLE_FUNCTION | ( | LOCK_RESULT | , |
| Lock | , | ||
| LOCK_HANDLE | , | ||
| handle | |||
| ) |
Acquires a lock on the given lock handle.
Uses platform specific mutex primitives in its implementation.
- Parameters:
-
handle A valid handle to the lock.
- Returns:
- Returns
LOCK_OKwhen a lock has been acquired andLOCK_ERRORwhen an error occurs.
| MOCKABLE_FUNCTION | ( | LOCK_HANDLE | , |
| Lock_Init | |||
| ) |
This API creates and returns a valid lock handle.
- Returns:
- A valid
LOCK_HANDLEwhen successful orNULLotherwise.
Generated on Tue Jul 12 2022 19:14:38 by
1.7.2
