Implementation of memory buffer locked in physical memory.
More...
#include <tsResidentBuffer.h>
|
| ResidentBuffer (size_t elem_count) |
| Constructor, based on required amount of elements.
|
|
| ~ResidentBuffer () |
| Destructor.
|
|
T * | base () const |
| Return base address of the buffer.
|
|
size_t | count () const |
| Return the number of elements in the buffer.
|
|
bool | isLocked () const |
| Check if the buffer is actually locked.
|
|
const std::error_code & | lockErrorCode () const |
| Get error code when not locked.
|
|
template<typename T = uint8_t>
class ts::ResidentBuffer< T >
Implementation of memory buffer locked in physical memory.
- Template Parameters
-
T | Type of the buffer element. |
◆ ResidentBuffer()
Constructor, based on required amount of elements.
Abort application if memory allocation fails.
Do not abort if memory locking fails. Some operating systems may place limitations on the amount of memory to lock. On DragonFlyBSD, the mlock() system call is reserved to the superuser and memory locking always fails with normal users. Consequently, failing to lock a memory buffer in physical memory is not a real error which prevents the application from working. At worst, there could be performance implications in case of page faults.
- Parameters
-
[in] | elem_count | Number of T elements. |
◆ isLocked()
template<typename T = uint8_t>
Check if the buffer is actually locked.
- Returns
- True if the buffer is actually locked, false if locking failed.
◆ lockErrorCode()
template<typename T = uint8_t>
Get error code when not locked.
- Returns
- A constant reference to the system error code when locking failed.
◆ base()
template<typename T = uint8_t>
Return base address of the buffer.
- Returns
- The address of the first T element in the buffer.
◆ count()
template<typename T = uint8_t>
Return the number of elements in the buffer.
- Returns
- The number of T elements in the buffer.
The documentation for this class was generated from the following file: