Android-cuttlefish cvd tool
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
cuttlefish::Epoll Class Reference

#include <epoll.h>

Collaboration diagram for cuttlefish::Epoll:
Collaboration graph
[legend]

Public Member Functions

 Epoll ()
 
 Epoll (Epoll &&)
 
Epolloperator= (Epoll &&)
 
Result< void > Add (SharedFD fd, uint32_t events)
 
Result< void > Modify (SharedFD fd, uint32_t events)
 
Result< void > AddOrModify (SharedFD fd, uint32_t events)
 
Result< void > Delete (SharedFD fd)
 
Result< std::optional< EpollEvent > > Wait ()
 

Static Public Member Functions

static Result< EpollCreate ()
 

Private Member Functions

 Epoll (SharedFD)
 

Private Attributes

std::shared_mutex epoll_mutex_
 
SharedFD epoll_fd_
 
std::shared_mutex watched_mutex_
 
std::set< SharedFDwatched_
 

Constructor & Destructor Documentation

◆ Epoll() [1/3]

cuttlefish::Epoll::Epoll ( )
default

◆ Epoll() [2/3]

cuttlefish::Epoll::Epoll ( Epoll &&  other)

◆ Epoll() [3/3]

cuttlefish::Epoll::Epoll ( SharedFD  epoll_fd)
private

Member Function Documentation

◆ Add()

Result< void > cuttlefish::Epoll::Add ( SharedFD  fd,
uint32_t  events 
)

◆ AddOrModify()

Result< void > cuttlefish::Epoll::AddOrModify ( SharedFD  fd,
uint32_t  events 
)

◆ Create()

Result< Epoll > cuttlefish::Epoll::Create ( )
static

◆ Delete()

Result< void > cuttlefish::Epoll::Delete ( SharedFD  fd)

◆ Modify()

Result< void > cuttlefish::Epoll::Modify ( SharedFD  fd,
uint32_t  events 
)

◆ operator=()

Epoll & cuttlefish::Epoll::operator= ( Epoll &&  other)

◆ Wait()

Result< std::optional< EpollEvent > > cuttlefish::Epoll::Wait ( )

Member Data Documentation

◆ epoll_fd_

SharedFD cuttlefish::Epoll::epoll_fd_
private

◆ epoll_mutex_

std::shared_mutex cuttlefish::Epoll::epoll_mutex_
private

This read-write mutex is read-locked to perform epoll operations, and write-locked to replace the file descriptor.

A read-write mutex is used here to make it possible to update the watched set while the epoll resource is being waited on by another thread, while excluding the possibility of the move constructor or assignment constructor from stealing the file descriptor out from under waiting threads.

◆ watched_

std::set<SharedFD> cuttlefish::Epoll::watched_
private

◆ watched_mutex_

std::shared_mutex cuttlefish::Epoll::watched_mutex_
private

This read-write mutex is read-locked when interacting with it as a const std::set, and write-locked when interacting with it as a std::set.


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