mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-13 10:52:56 +01:00
Bug in kqueue poller fixed (issue 261)
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
This commit is contained in:
parent
6c1b50cfab
commit
b3cda2ad60
@ -33,6 +33,7 @@
|
||||
#include "err.hpp"
|
||||
#include "config.hpp"
|
||||
#include "i_poll_events.hpp"
|
||||
#include "likely.hpp"
|
||||
|
||||
// NetBSD defines (struct kevent).udata as intptr_t, everyone else
|
||||
// as void *.
|
||||
@ -106,29 +107,37 @@ void zmq::kqueue_t::rm_fd (handle_t handle_)
|
||||
void zmq::kqueue_t::set_pollin (handle_t handle_)
|
||||
{
|
||||
poll_entry_t *pe = (poll_entry_t*) handle_;
|
||||
pe->flag_pollin = true;
|
||||
kevent_add (pe->fd, EVFILT_READ, pe);
|
||||
if (likely (!pe->flag_pollin)) {
|
||||
pe->flag_pollin = true;
|
||||
kevent_add (pe->fd, EVFILT_READ, pe);
|
||||
}
|
||||
}
|
||||
|
||||
void zmq::kqueue_t::reset_pollin (handle_t handle_)
|
||||
{
|
||||
poll_entry_t *pe = (poll_entry_t*) handle_;
|
||||
pe->flag_pollin = false;
|
||||
kevent_delete (pe->fd, EVFILT_READ);
|
||||
if (likely (pe->flag_pollin)) {
|
||||
pe->flag_pollin = false;
|
||||
kevent_delete (pe->fd, EVFILT_READ);
|
||||
}
|
||||
}
|
||||
|
||||
void zmq::kqueue_t::set_pollout (handle_t handle_)
|
||||
{
|
||||
poll_entry_t *pe = (poll_entry_t*) handle_;
|
||||
pe->flag_pollout = true;
|
||||
kevent_add (pe->fd, EVFILT_WRITE, pe);
|
||||
if (likely (!pe->flag_pollout)) {
|
||||
pe->flag_pollout = true;
|
||||
kevent_add (pe->fd, EVFILT_WRITE, pe);
|
||||
}
|
||||
}
|
||||
|
||||
void zmq::kqueue_t::reset_pollout (handle_t handle_)
|
||||
{
|
||||
poll_entry_t *pe = (poll_entry_t*) handle_;
|
||||
pe->flag_pollout = false;
|
||||
kevent_delete (pe->fd, EVFILT_WRITE);
|
||||
if (likely (pe->flag_pollout)) {
|
||||
pe->flag_pollout = false;
|
||||
kevent_delete (pe->fd, EVFILT_WRITE);
|
||||
}
|
||||
}
|
||||
|
||||
void zmq::kqueue_t::start ()
|
||||
|
Loading…
Reference in New Issue
Block a user