3 #ifndef __ZMQ_SELECT_HPP_INCLUDED__
4 #define __ZMQ_SELECT_HPP_INCLUDED__
8 #if defined ZMQ_IOTHREAD_POLLER_USE_SELECT
14 #if defined ZMQ_HAVE_WINDOWS
15 #elif defined ZMQ_HAVE_OPENVMS
16 #include <sys/types.h>
19 #include <sys/select.h>
33 class select_t
ZMQ_FINAL :
public worker_poller_base_t
36 typedef fd_t handle_t;
38 select_t (
const thread_ctx_t &ctx_);
42 handle_t add_fd (
fd_t fd_,
zmq::i_poll_events *events_);
43 void rm_fd (handle_t handle_);
44 void set_pollin (handle_t handle_);
45 void reset_pollin (handle_t handle_);
46 void set_pollout (handle_t handle_);
47 void reset_pollout (handle_t handle_);
50 static
int max_fds ();
60 fds_set_t (
const fds_set_t &other_);
61 fds_set_t &operator= (
const fds_set_t &other_);
63 void remove_fd (
const fd_t &fd_);
75 typedef std::vector<fd_entry_t> fd_entries_t;
77 void trigger_events (
const fd_entries_t &fd_entries_,
78 const fds_set_t &local_fds_set_,
85 fd_entries_t fd_entries;
90 void select_family_entry (family_entry_t &family_entry_,
95 #if defined ZMQ_HAVE_WINDOWS
96 typedef std::map<u_short, family_entry_t> family_entries_t;
107 family_entries_t _family_entries;
109 family_entries_t::iterator _current_family_entry_it;
111 int try_retire_fd_entry (family_entries_t::iterator family_entry_it_,
114 static const size_t fd_family_cache_size = 8;
115 std::pair<fd_t, u_short> _fd_family_cache[fd_family_cache_size];
117 u_short get_fd_family (
fd_t fd_);
120 static u_short determine_fd_family (
fd_t fd_);
123 family_entry_t _family_entry;
127 void cleanup_retired ();
128 bool cleanup_retired (family_entry_t &family_entry_);
131 static bool is_retired_fd (
const fd_entry_t &entry_);
133 static fd_entries_t::iterator
134 find_fd_entry_by_handle (fd_entries_t &fd_entries_, handle_t handle_);
139 typedef select_t poller_t;