Zth (libzth)
zth::PollableFd Struct Reference

A pollable file descriptor. More...

#include <poller.h>

Inheritance diagram for zth::PollableFd:
zth::Pollable

Public Member Functions

constexpr PollableFd (int fd, Events const &e, void *user=nullptr) noexcept
 Ctor for a file descriptor. More...
 
constexpr PollableFd (void *socket, Events const &e, void *user=nullptr) noexcept
 Ctor for a ZeroMQ socket. More...
 
- Public Member Functions inherited from zth::Pollable
constexpr Pollable (Events const &e, void *user=nullptr) noexcept
 Ctor. More...
 

Public Attributes

void * socket
 The ZeroMQ socket. More...
 
int fd
 The file descriptor. More...
 
- Public Attributes inherited from zth::Pollable
void * user_data
 User data. More...
 
Events events
 Events to poll. More...
 
Events revents
 Returned events by a poll. More...
 

Additional Inherited Members

- Public Types inherited from zth::Pollable
enum  EventsFlags {
  PollInIndex , PollOutIndex , PollErrIndex , PollPriIndex ,
  PollHupIndex , FlagCount
}
 Flags to be used with events and revents. More...
 
typedef std::bitset< FlagCountEvents
 Type of events and revents. More...
 
- Static Public Attributes inherited from zth::Pollable
static const unsigned long PollIn = 1UL << PollInIndex
 
static const unsigned long PollOut = 1UL << PollOutIndex
 
static const unsigned long PollErr = 1UL << PollErrIndex
 
static const unsigned long PollPri = 1UL << PollPriIndex
 
static const unsigned long PollHup = 1UL << PollHupIndex
 

Detailed Description

A pollable file descriptor.

In Windows, the fd must be either a WSA2 or ZeroMQ socket.

Definition at line 138 of file poller.h.

Constructor & Destructor Documentation

◆ PollableFd() [1/2]

constexpr zth::PollableFd::PollableFd ( int  fd,
Events const &  e,
void *  user = nullptr 
)
inlineconstexprnoexcept

Ctor for a file descriptor.

Do not pass ZeroMQ sockets as a file descriptor. Use the socket void* for that.

Definition at line 145 of file poller.h.

◆ PollableFd() [2/2]

constexpr zth::PollableFd::PollableFd ( void *  socket,
Events const &  e,
void *  user = nullptr 
)
inlineconstexprnoexcept

Ctor for a ZeroMQ socket.

Definition at line 157 of file poller.h.

Member Data Documentation

◆ fd

int zth::PollableFd::fd

The file descriptor.

If socket is set, this field is ignored. Do not change the value after adding the Pollable to a Poller.

Definition at line 178 of file poller.h.

◆ socket

void* zth::PollableFd::socket

The ZeroMQ socket.

If set, it fd is ignored. Do not change the value after adding the Pollable to a Poller.

Definition at line 169 of file poller.h.


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