Zth (libzth)
Loading...
Searching...
No Matches
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 f, Events const &e, void *user=nullptr) noexcept
 Ctor for a file descriptor.
 
constexpr PollableFd (void *s, Events const &e, void *user=nullptr) noexcept
 Ctor for a ZeroMQ socket.
 
- Public Member Functions inherited from zth::Pollable
constexpr Pollable (Events const &e, void *user=nullptr) noexcept
 Ctor.
 

Public Attributes

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

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.
 
- 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 135 of file poller.h.

Constructor & Destructor Documentation

◆ PollableFd() [1/2]

constexpr zth::PollableFd::PollableFd ( int  f,
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 142 of file poller.h.

◆ PollableFd() [2/2]

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

Ctor for a ZeroMQ socket.

Definition at line 154 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 175 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 166 of file poller.h.


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