mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-06 00:31:13 +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 "err.hpp"
|
||||||
#include "config.hpp"
|
#include "config.hpp"
|
||||||
#include "i_poll_events.hpp"
|
#include "i_poll_events.hpp"
|
||||||
|
#include "likely.hpp"
|
||||||
|
|
||||||
// NetBSD defines (struct kevent).udata as intptr_t, everyone else
|
// NetBSD defines (struct kevent).udata as intptr_t, everyone else
|
||||||
// as void *.
|
// as void *.
|
||||||
@ -106,30 +107,38 @@ void zmq::kqueue_t::rm_fd (handle_t handle_)
|
|||||||
void zmq::kqueue_t::set_pollin (handle_t handle_)
|
void zmq::kqueue_t::set_pollin (handle_t handle_)
|
||||||
{
|
{
|
||||||
poll_entry_t *pe = (poll_entry_t*) handle_;
|
poll_entry_t *pe = (poll_entry_t*) handle_;
|
||||||
|
if (likely (!pe->flag_pollin)) {
|
||||||
pe->flag_pollin = true;
|
pe->flag_pollin = true;
|
||||||
kevent_add (pe->fd, EVFILT_READ, pe);
|
kevent_add (pe->fd, EVFILT_READ, pe);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void zmq::kqueue_t::reset_pollin (handle_t handle_)
|
void zmq::kqueue_t::reset_pollin (handle_t handle_)
|
||||||
{
|
{
|
||||||
poll_entry_t *pe = (poll_entry_t*) handle_;
|
poll_entry_t *pe = (poll_entry_t*) handle_;
|
||||||
|
if (likely (pe->flag_pollin)) {
|
||||||
pe->flag_pollin = false;
|
pe->flag_pollin = false;
|
||||||
kevent_delete (pe->fd, EVFILT_READ);
|
kevent_delete (pe->fd, EVFILT_READ);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void zmq::kqueue_t::set_pollout (handle_t handle_)
|
void zmq::kqueue_t::set_pollout (handle_t handle_)
|
||||||
{
|
{
|
||||||
poll_entry_t *pe = (poll_entry_t*) handle_;
|
poll_entry_t *pe = (poll_entry_t*) handle_;
|
||||||
|
if (likely (!pe->flag_pollout)) {
|
||||||
pe->flag_pollout = true;
|
pe->flag_pollout = true;
|
||||||
kevent_add (pe->fd, EVFILT_WRITE, pe);
|
kevent_add (pe->fd, EVFILT_WRITE, pe);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void zmq::kqueue_t::reset_pollout (handle_t handle_)
|
void zmq::kqueue_t::reset_pollout (handle_t handle_)
|
||||||
{
|
{
|
||||||
poll_entry_t *pe = (poll_entry_t*) handle_;
|
poll_entry_t *pe = (poll_entry_t*) handle_;
|
||||||
|
if (likely (pe->flag_pollout)) {
|
||||||
pe->flag_pollout = false;
|
pe->flag_pollout = false;
|
||||||
kevent_delete (pe->fd, EVFILT_WRITE);
|
kevent_delete (pe->fd, EVFILT_WRITE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void zmq::kqueue_t::start ()
|
void zmq::kqueue_t::start ()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user