Go to the documentation of this file.
42 #include <boost/bind/bind.hpp>
72 info.
func_ = update_func;
77 bool b =
socket_info_.insert(std::make_pair(fd, info)).second;
120 ROSCPP_LOG_DEBUG(
"PollSet: Tried to delete fd [%d] which is not being tracked", fd);
134 ROSCPP_LOG_DEBUG(
"PollSet: Tried to add events [%d] to fd [%d] which does not exist in this pollset", events, sock);
138 it->second.events_ |= events;
155 it->second.events_ &= ~events;
159 ROSCPP_LOG_DEBUG(
"PollSet: Tried to delete events [%d] to fd [%d] which does not exist in this pollset", events, sock);
175 if (lock.owns_lock())
201 for (std::vector<socket_pollfd>::iterator it = ofds->begin() ; it != ofds->end(); ++it)
204 int revents = it->revents;
233 && ((events & revents)
234 || (revents & POLLERR)
235 || (revents & POLLHUP)
236 || (revents & POLLNVAL)))
239 if (revents & (POLLNVAL|POLLERR|POLLHUP))
255 func(revents & (events|POLLERR|POLLHUP|POLLNVAL));
279 for (
int i = 0; sock_it != sock_end; ++sock_it, ++i)
boost::mutex socket_info_mutex_
bool delSocket(int sock)
Delete a socket.
#define ROS_ERROR_STREAM(args)
ROSCPP_DECL int create_signal_pair(signal_fd_t signal_pair[2])
ROSCPP_DECL pollfd_vector_ptr poll_sockets(int epfd, socket_pollfd *fds, nfds_t nfds, int timeout)
A cross platform polling function for sockets.
ssize_t read_signal(const signal_fd_t &signal, void *buffer, const size_t &nbyte)
void close_signal_pair(signal_fd_t signal_pair[2])
signal_fd_t signal_pipe_[2]
bool addEvents(int sock, int events)
Add events to be polled on a socket.
ssize_t write_signal(const signal_fd_t &signal, const void *buffer, const size_t &nbyte)
bool addSocket(int sock, const SocketUpdateFunc &update_func, const TransportPtr &transport=TransportPtr())
Add a socket.
M_SocketInfo socket_info_
void signal()
Signal our poll() call to finish if it's blocked waiting (see the poll_timeout option for update()).
void onLocalPipeEvents(int events)
Called when events have been triggered on our signal pipe.
ROSCPP_DECL void close_socket_watcher(int fd)
void update(int poll_timeout)
Process all socket events.
bool delEvents(int sock, int events)
Delete events to be polled on a socket.
ROSCPP_DECL void del_socket_from_watcher(int epfd, int fd)
boost::mutex just_deleted_mutex_
ROSCPP_DECL void add_socket_to_watcher(int epfd, int fd)
boost::function< void(int)> SocketUpdateFunc
void createNativePollset()
Creates the native pollset for our sockets, if any have changed.
ROSCPP_DECL int last_socket_error()
boost::mutex signal_mutex_
struct pollfd socket_pollfd
ROSCPP_DECL void set_events_on_socket(int epfd, int fd, int events)
#define ROSCPP_LOG_DEBUG(...)
const ROSCPP_DECL char * last_socket_error_string()
std::vector< socket_pollfd > ufds_
ROSCPP_DECL int create_socket_watcher()
roscpp
Author(s): Morgan Quigley, Josh Faust, Brian Gerkey, Troy Straszheim, Dirk Thomas
, Jacob Perron
autogenerated on Sat Sep 14 2024 02:59:35