userver: engine::io::Poller Class Reference
Loading...
Searching...
No Matches
engine::io::Poller Class Referencefinal

#include <userver/engine/io/poller.hpp>

Detailed Description

I/O event monitor.

Warning
Generally not thread-safe, awaited events should not be changed during active waiting.
Note
Reports HUP as readiness.

Definition at line 22 of file poller.hpp.

Classes

struct  Event
 I/O event. More...
 

Public Types

enum class  Status {
  kSuccess ,
  kInterrupt ,
  kNoEvents
}
 Event retrieval status. More...
 

Public Member Functions

 Poller (const Poller &)=delete
 
 Poller (Poller &&)=delete
 
void Add (int fd, utils::Flags< Event::Type > events)
 
void Remove (int fd)
 
Status NextEvent (Event &, Deadline)
 Waits for the next event and stores it at the provided structure.
 
Status NextEventNoblock (Event &)
 Outputs the next event if immediately available.
 
void Interrupt ()
 Emits an event for an invalid fd with empty event types set.
 
void Reset ()
 Clears all the watched events and file descriptors.
 

Member Enumeration Documentation

◆ Status

enum class engine::io::Poller::Status
strong

Event retrieval status.

Enumerator
kSuccess 

Received an event.

kInterrupt 

Received an interrupt request.

kNoEvents 

No new events available or task has been cancelled.

Definition at line 44 of file poller.hpp.

Member Function Documentation

◆ Add()

void engine::io::Poller::Add ( int fd,
utils::Flags< Event::Type > events )

Updates a set of events to be monitored for the file descriptor.

At most one set of events is reported for every Add invocation.

Note
Event::Type::kError is implicit when any other event type is specified.

◆ Remove()

void engine::io::Poller::Remove ( int fd)

Disables event monitoring on a specific file descriptor.

This function must be called before closing the socket.


The documentation for this class was generated from the following file: