diff --git a/include/zmq.h b/include/zmq.h index 208850ce..68925048 100644 --- a/include/zmq.h +++ b/include/zmq.h @@ -447,9 +447,9 @@ typedef struct zmq_poller_event_t ZMQ_EXPORT void *zmq_poller_new (); ZMQ_EXPORT int zmq_poller_close (void *poller); -ZMQ_EXPORT int zmq_poller_add_socket (void *poller, void *socket, void *user_data, short events); -ZMQ_EXPORT int zmq_poller_modify_socket (void *poller, void *socket, short events); -ZMQ_EXPORT int zmq_poller_remove_socket (void *poller, void *socket); +ZMQ_EXPORT int zmq_poller_add (void *poller, void *socket, void *user_data, short events); +ZMQ_EXPORT int zmq_poller_modify (void *poller, void *socket, short events); +ZMQ_EXPORT int zmq_poller_remove (void *poller, void *socket); ZMQ_EXPORT int zmq_poller_wait (void *poller, zmq_poller_event_t *event, long timeout); #if defined _WIN32 @@ -458,7 +458,7 @@ ZMQ_EXPORT int zmq_poller_modify_fd (void *poller, SOCKET fd, short events); ZMQ_EXPORT int zmq_poller_remove_fd (void *poller, SOCKET fd); #else ZMQ_EXPORT int zmq_poller_add_fd (void *poller, int fd, void *user_data, short events); -ZMQ_EXPORT int zmq_poller_modify (void *poller, int fd, short events); +ZMQ_EXPORT int zmq_poller_modify_fd (void *poller, int fd, short events); ZMQ_EXPORT int zmq_poller_remove_fd (void *poller, int fd); #endif diff --git a/src/socket_poller.cpp b/src/socket_poller.cpp index b198b34b..77f5f65e 100644 --- a/src/socket_poller.cpp +++ b/src/socket_poller.cpp @@ -61,7 +61,7 @@ bool zmq::socket_poller_t::check_tag () return tag == 0xCAFEBABE; } -int zmq::socket_poller_t::add_socket (void *socket_, void* user_data_, short events_) +int zmq::socket_poller_t::add (void *socket_, void* user_data_, short events_) { for (events_t::iterator it = events.begin (); it != events.end (); ++it) { if (it->socket == socket_) { @@ -108,7 +108,7 @@ int zmq::socket_poller_t::add_fd (int fd_, void *user_data_, short events_) return 0; } -int zmq::socket_poller_t::modify_socket (void *socket_, short events_) +int zmq::socket_poller_t::modify (void *socket_, short events_) { events_t::iterator it; @@ -154,7 +154,7 @@ int zmq::socket_poller_t::modify_fd (int fd_, short events_) } -int zmq::socket_poller_t::remove_socket (void* socket_) +int zmq::socket_poller_t::remove (void* socket_) { events_t::iterator it; diff --git a/src/socket_poller.hpp b/src/socket_poller.hpp index c1ed79c4..95f7dad0 100644 --- a/src/socket_poller.hpp +++ b/src/socket_poller.hpp @@ -56,9 +56,9 @@ namespace zmq short events; } event_t; - int add_socket (void *socket, void *user_data, short events); - int modify_socket (void *socket, short events); - int remove_socket (void *socket); + int add (void *socket, void *user_data, short events); + int modify (void *socket, short events); + int remove (void *socket); #if defined _WIN32 int add_fd (SOCKET fd, void *user_data, short events); int modify_fd (SOCKET fd, short events); diff --git a/src/zmq.cpp b/src/zmq.cpp index ad777099..4413b61c 100644 --- a/src/zmq.cpp +++ b/src/zmq.cpp @@ -1579,14 +1579,14 @@ int zmq_poller_close (void *poller_) return 0; } -int zmq_poller_add_socket (void *poller_, void *socket_, void *user_data_, short events_) +int zmq_poller_add (void *poller_, void *socket_, void *user_data_, short events_) { if (!poller_ || !((zmq::socket_poller_t*)poller_)->check_tag ()) { errno = EFAULT; return -1; } - return ((zmq::socket_poller_t*)poller_)->add_socket (socket_, user_data_, events_); + return ((zmq::socket_poller_t*)poller_)->add (socket_, user_data_, events_); } #if defined _WIN32 @@ -1604,14 +1604,14 @@ int zmq_poller_add_fd (void *poller_, int fd_, void *user_data_, short events_) } -int zmq_poller_modify_socket (void *poller_, void *socket_, short events_) +int zmq_poller_modify (void *poller_, void *socket_, short events_) { if (!poller_ || !((zmq::socket_poller_t*)poller_)->check_tag ()) { errno = EFAULT; return -1; } - return ((zmq::socket_poller_t*)poller_)->modify_socket (socket_, events_); + return ((zmq::socket_poller_t*)poller_)->modify (socket_, events_); } @@ -1630,14 +1630,14 @@ int zmq_poller_modify_fd (void *poller_, int fd_, short events_) } -int zmq_poller_remove_socket (void *poller_, void *socket) +int zmq_poller_remove (void *poller_, void *socket) { if (!poller_ || !((zmq::socket_poller_t*)poller_)->check_tag ()) { errno = EFAULT; return -1; } - return ((zmq::socket_poller_t*)poller_)->remove_socket (socket); + return ((zmq::socket_poller_t*)poller_)->remove (socket); } #if defined _WIN32 diff --git a/tests/test_poller.cpp b/tests/test_poller.cpp index fcfeefac..36ddd51b 100644 --- a/tests/test_poller.cpp +++ b/tests/test_poller.cpp @@ -61,7 +61,7 @@ int main (void) // Set up poller void* poller = zmq_poller_new (); - rc = zmq_poller_add_socket (poller, sink, sink, ZMQ_POLLIN); + rc = zmq_poller_add (poller, sink, sink, ZMQ_POLLIN); assert (rc == 0); // Send a message @@ -79,7 +79,7 @@ int main (void) assert (rc == 1); // Stop polling sink - rc = zmq_poller_remove_socket (poller, sink); + rc = zmq_poller_remove (poller, sink); assert (rc == 0); // Check we can poll an FD @@ -106,7 +106,7 @@ int main (void) zmq_poller_remove_fd (poller, fd); // Polling on thread safe sockets - rc = zmq_poller_add_socket (poller, server, NULL, ZMQ_POLLIN); + rc = zmq_poller_add (poller, server, NULL, ZMQ_POLLIN); assert (rc == 0); rc = zmq_connect (client, "tcp://127.0.0.1:55557"); assert (rc == 0); @@ -120,7 +120,7 @@ int main (void) assert (rc == 1); // Polling on pollout - rc = zmq_poller_modify_socket (poller, server, ZMQ_POLLOUT | ZMQ_POLLIN); + rc = zmq_poller_modify (poller, server, ZMQ_POLLOUT | ZMQ_POLLIN); assert (rc == 0); rc = zmq_poller_wait (poller, &event, 0); assert (rc == 0);