Non-owning wrapper around a file descriptor.
More...
#include <dfx-fdwatch/BorrowedFd.hpp>
Non-owning wrapper around a file descriptor.
BorrowedFd provides a lightweight, copyable view of an existing file descriptor. It does not own the descriptor and will never close it.
The referenced file descriptor must remain valid for the entire lifetime of all BorrowedFd instances referring to it.
An invalid BorrowedFd is represented by a value of -1.
- See also
- OwnedFd, PollerFd
◆ BorrowedFd() [1/4]
| dfx::FdWatch::BorrowedFd::BorrowedFd |
( |
| ) |
|
|
defaultnoexcept |
◆ BorrowedFd() [2/4]
| dfx::FdWatch::BorrowedFd::BorrowedFd |
( |
PollerFd const & | fd | ) |
|
|
explicitnoexcept |
Create a non-owning view from a PollerFd.
- Parameters
-
- Note
- Does not take ownership. The PollerFd must outlive this object.
◆ BorrowedFd() [3/4]
| dfx::FdWatch::BorrowedFd::BorrowedFd |
( |
OwnedFd const & | fd | ) |
|
|
explicitnoexcept |
Create a non-owning view from a OwnedFd.
- Parameters
-
- Note
- Does not take ownership. The OwnedFd must outlive this object.
◆ BorrowedFd() [4/4]
| dfx::FdWatch::BorrowedFd::BorrowedFd |
( |
int | fd | ) |
|
|
explicitnoexcept |
Create a non-owning view from a raw file descriptor.
- Parameters
-
- Note
- This object does not manage the lifetime of fd.
◆ get()
| int dfx::FdWatch::BorrowedFd::get |
( |
| ) |
const |
|
inlinenoexcept |
Get the underlying file descriptor value.
- Returns
- The file descriptor, or -1 if invalid
◆ isValid()
| bool dfx::FdWatch::BorrowedFd::isValid |
( |
| ) |
const |
|
inlinenoexcept |
Check if the current BorrowedFd contains a valid fd.
◆ reset()
| void dfx::FdWatch::BorrowedFd::reset |
( |
| ) |
|
|
inlinenoexcept |
Invalidate this BorrowedFd.
- Note
- Does not close the underlying file descriptor.
The documentation for this class was generated from the following file: