Commit d83b0453 authored by somdoron's avatar somdoron

rename poller to pollfd

parent 5bae6911
...@@ -383,8 +383,8 @@ ZMQ_EXPORT int zmq_send (void *s, const void *buf, size_t len, int flags); ...@@ -383,8 +383,8 @@ ZMQ_EXPORT int zmq_send (void *s, const void *buf, size_t len, int flags);
ZMQ_EXPORT int zmq_send_const (void *s, const void *buf, size_t len, int flags); ZMQ_EXPORT int zmq_send_const (void *s, const void *buf, size_t len, int flags);
ZMQ_EXPORT int zmq_recv (void *s, void *buf, size_t len, int flags); ZMQ_EXPORT int zmq_recv (void *s, void *buf, size_t len, int flags);
ZMQ_EXPORT int zmq_socket_monitor (void *s, const char *addr, int events); ZMQ_EXPORT int zmq_socket_monitor (void *s, const char *addr, int events);
ZMQ_EXPORT int zmq_add_poller (void *s, void *p); ZMQ_EXPORT int zmq_add_pollfd (void *s, void *p);
ZMQ_EXPORT int zmq_remove_poller (void *s, void *p); ZMQ_EXPORT int zmq_remove_pollfd (void *s, void *p);
/******************************************************************************/ /******************************************************************************/
/* I/O multiplexing. */ /* I/O multiplexing. */
...@@ -410,13 +410,13 @@ typedef struct zmq_pollitem_t ...@@ -410,13 +410,13 @@ typedef struct zmq_pollitem_t
#define ZMQ_POLLITEMS_DFLT 16 #define ZMQ_POLLITEMS_DFLT 16
ZMQ_EXPORT int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout); ZMQ_EXPORT int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout);
ZMQ_EXPORT void *zmq_poller_new (); ZMQ_EXPORT void *zmq_pollfd_new ();
ZMQ_EXPORT int zmq_poller_close (void *p); ZMQ_EXPORT int zmq_pollfd_close (void *p);
#if defined _WIN32 #if defined _WIN32
ZMQ_EXPORT SOCKET zmq_poller_fd (void *p); ZMQ_EXPORT SOCKET zmq_pollfd_fd (void *p);
#else #else
ZMQ_EXPORT int zmq_poller_fd (void *p); ZMQ_EXPORT int zmq_pollfd_fd (void *p);
#endif #endif
/******************************************************************************/ /******************************************************************************/
......
...@@ -562,9 +562,9 @@ int zmq_recviov (void *s_, iovec *a_, size_t *count_, int flags_) ...@@ -562,9 +562,9 @@ int zmq_recviov (void *s_, iovec *a_, size_t *count_, int flags_)
return nread; return nread;
} }
// Add/remove poller from a socket // Add/remove pollfd from a socket
int zmq_add_poller (void *s_, void *p_) int zmq_add_pollfd (void *s_, void *p_)
{ {
if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) { if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) {
errno = ENOTSOCK; errno = ENOTSOCK;
...@@ -576,7 +576,7 @@ int zmq_add_poller (void *s_, void *p_) ...@@ -576,7 +576,7 @@ int zmq_add_poller (void *s_, void *p_)
return s->add_signaler(p); return s->add_signaler(p);
} }
int zmq_remove_poller (void *s_, void *p_) int zmq_remove_pollfd (void *s_, void *p_)
{ {
if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) { if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) {
errno = ENOTSOCK; errno = ENOTSOCK;
...@@ -709,16 +709,16 @@ const char *zmq_msg_gets (zmq_msg_t *msg_, const char *property_) ...@@ -709,16 +709,16 @@ const char *zmq_msg_gets (zmq_msg_t *msg_, const char *property_)
} }
} }
// Create poller // Create pollfd
void *zmq_poller_new () void *zmq_pollfd_new ()
{ {
return new zmq::signaler_t (); return new zmq::signaler_t ();
} }
// Close poller // Close pollfd
int zmq_poller_close (void* p) int zmq_pollfd_close (void* p)
{ {
zmq::signaler_t *s = (zmq::signaler_t*)p; zmq::signaler_t *s = (zmq::signaler_t*)p;
delete s; delete s;
...@@ -728,9 +728,9 @@ int zmq_poller_close (void* p) ...@@ -728,9 +728,9 @@ int zmq_poller_close (void* p)
// Get poller fd // Get poller fd
#if defined _WIN32 #if defined _WIN32
SOCKET zmq_poller_fd (void *p) SOCKET zmq_pollfd_fd (void *p)
#else #else
int zmq_poller_fd (void *p) int zmq_pollfd_fd (void *p)
#endif #endif
{ {
zmq::signaler_t *s = (zmq::signaler_t*)p; zmq::signaler_t *s = (zmq::signaler_t*)p;
......
...@@ -39,19 +39,19 @@ int main (void) ...@@ -39,19 +39,19 @@ int main (void)
void *server = zmq_socket (ctx, ZMQ_SERVER); void *server = zmq_socket (ctx, ZMQ_SERVER);
void *server2 = zmq_socket (ctx, ZMQ_SERVER); void *server2 = zmq_socket (ctx, ZMQ_SERVER);
void *poller = zmq_poller_new (); void *pollfd = zmq_pollfd_new ();
int rc; int rc;
rc = zmq_add_poller (server, poller); rc = zmq_add_pollfd (server, pollfd);
assert (rc == 0); assert (rc == 0);
rc = zmq_add_poller (server2, poller); rc = zmq_add_pollfd (server2, pollfd);
assert (rc == 0); assert (rc == 0);
zmq_pollitem_t items[] = { zmq_pollitem_t items[] = {
{server, zmq_poller_fd(poller), ZMQ_POLLIN, 0}, {server, zmq_pollfd_fd(pollfd), ZMQ_POLLIN, 0},
{server2, zmq_poller_fd(poller), ZMQ_POLLIN, 0}}; {server2, zmq_pollfd_fd(pollfd), ZMQ_POLLIN, 0}};
rc = zmq_bind (server, "tcp://127.0.0.1:5560"); rc = zmq_bind (server, "tcp://127.0.0.1:5560");
assert (rc == 0); assert (rc == 0);
...@@ -94,13 +94,13 @@ int main (void) ...@@ -94,13 +94,13 @@ int main (void)
rc = zmq_msg_close(&msg); rc = zmq_msg_close(&msg);
assert (rc == 0); assert (rc == 0);
rc = zmq_remove_poller (server, poller); rc = zmq_remove_pollfd (server, pollfd);
assert (rc == 0); assert (rc == 0);
rc = zmq_remove_poller (server2, poller); rc = zmq_remove_pollfd (server2, pollfd);
assert (rc == 0); assert (rc == 0);
rc = zmq_poller_close (poller); rc = zmq_pollfd_close (pollfd);
assert (rc == 0); assert (rc == 0);
rc = zmq_close (server); rc = zmq_close (server);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment