Representation of epoll(7).
More...
#include <epoll.hh>
|
|
static const int | kFdType = 6 |
| |
|
static const int | kInvalidFd = -1 |
| |
|
| static std::string | ErrMsg () |
| | Get latest errno and error message. More...
|
| |
Representation of epoll(7).
| bool CEpoll::addFd |
( |
int |
fd, |
|
|
uint32_t |
flags, |
|
|
bool |
mod = true |
|
) |
| |
|
inline |
Add fd (file descriptor) to epoll.
- Parameters
-
| fd | File descriptor, a non-negative number |
| flags | A bit mask of events to monitor, e.g. EPOLLIN, EPOLLOUT |
| mod |
true: If fd is already in epoll, modify its flags
false: If fd is already in epoll, this operation will fail
|
- Returns
true if succeeded; false otherwise
Initialize epoll.
- Returns
true if succeeded; false otherwise
| bool CEpoll::delFd |
( |
int |
fd | ) |
|
|
inline |
Remove an fd (file descriptor) from epoll.
- Parameters
-
| fd | File descriptor, a non-negative number |
- Returns
true if succeeded; false otherwise
| int CEpoll::fdType |
( |
| ) |
const |
|
inlinevirtual |
Get fd (file descriptor) type identifier.
- Returns
6
Implements IFileDesc.
| const char* CEpoll::fdTypeName |
( |
| ) |
const |
|
inlinevirtual |
Get fd (file identifier) type name.
- Returns
"CEpoll"
Implements IFileDesc.
| bool CEpoll::modFd |
( |
int |
fd, |
|
|
uint32_t |
flags, |
|
|
bool |
add = true |
|
) |
| |
|
inline |
Modify flags of an fd (file descriptor).
- Parameters
-
| fd | File descriptor, a non-negative number |
| flags | A bit mask of events to monitor, e.g. EPOLLIN, EPOLLOUT |
| add |
true: If fd is not in epoll, add it
false: If fd is not in epoll, this operation will fail
|
- Returns
| const CEpollEvent& CEpoll::operator[] |
( |
size_t |
i | ) |
const |
|
inline |
Get events of a ready file descriptor.
- Parameters
-
| i | Index of ready file descriptors list |
- Returns
- Readonly events object for the file descriptor
| size_t CEpoll::size |
( |
| ) |
const |
|
inline |
Get number of file descriptors that have pending events.
- Returns
- Number of ready file descriptors
| std::string CEpoll::toString |
( |
| ) |
const |
|
inlinevirtual |
Get readable description.
- Returns
- Readable description of this object
Reimplemented from IFileDesc.
| bool CEpoll::wait |
( |
int |
timeoutMs = -1 | ) |
|
|
inline |
Wait for epoll events.
This function checks if there are pending events, and blocks current thread for an amount of time if necessary.
- Parameters
-
| timeoutMs |
-1: Wait forever if there is no events
0: Return immediately no matter there are events or not
- Positive Number: Milliseconds to wait if there is no events
|
- Returns
true if there are events; false if time is out and there is no event
The documentation for this class was generated from the following file: