nlib
|
When a single sender thread sends data and a single receiver thread receives that data, you can use this class to transfer data in a lock-free manner. More...
#include "nn/nlib/LockFree.h"
Public Member Functions | |
size_t | GetBufferSize () noexcept |
Returns the buffer size. This is thread-safe. | |
errno_t | Read (void *dest, size_t nbytes) noexcept |
Reads data from a pipe. This is thread-safe. More... | |
errno_t | Write (const void *src, size_t nbytes) noexcept |
Writes data to a pipe. This is thread-safe. More... | |
Constructor, Destructor, and Initialization | |
LockFreePipe () noexcept | |
Instantiates the object with default parameters (default constructor). | |
When a single sender thread sends data and a single receiver thread receives that data, you can use this class to transfer data in a lock-free manner.
N | The size of the buffer. This value must be a power of two. |
LockFreePipe
, you can send and receive data each other between two threads. Definition at line 351 of file LockFree.h.
|
inlinenoexcept |
Reads data from a pipe. This is thread-safe.
[out] | dest | The region that stores read data. |
[in] | nbytes | The number of bytes to be read. |
0 | Success. |
EAGAIN | The buffer contains data of less than nbytes bytes. |
Definition at line 360 of file LockFree.h.
|
inlinenoexcept |
Writes data to a pipe. This is thread-safe.
[in] | src | The region that stores data to be written. |
[in] | nbytes | The number of bytes to be written. |
0 | Success. |
EAGAIN | The amount of free space in the buffer is less than nbytes bytes. |
Definition at line 383 of file LockFree.h.
© Nintendo Co., Ltd. All rights reserved.