mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-26 23:01:04 +08:00
Problem: regression with "select" on *nix (#2940)
* Problem: build failure with select as polling mechanism Solution: cast mailbox_handle argument to (poller_t::handle_t) like in the reaper thread class. * Problem: build failure due to INT_MAX use without include Solution: include limits and climits in src/select.cpp where INT_MAX is used * Problem: build failure due to unused variable in select.cpp Solution: move the declaration of int rc inside the ifdef block where it is actually used * Problem: reference to wrong variable in select.cpp breaks build Solution: fix it * Problem: family_entry_t constructor has no body, build fails on *nix Solution: add empty inline function in the struct * Problem: no test coverage for poll and select Solution: add Travis jobs for them on Linux * Problem: Travis jobs cannot run in container infra Solution: set sudo: false as it is not required anymore
This commit is contained in:
parent
afd5d9f721
commit
d0e01b4bb2
@ -92,8 +92,12 @@ matrix:
|
|||||||
- llvm-toolchain-trusty-5.0
|
- llvm-toolchain-trusty-5.0
|
||||||
packages:
|
packages:
|
||||||
- clang-5.0
|
- clang-5.0
|
||||||
|
- env: BUILD_TYPE=default POLLER=poll
|
||||||
|
os: linux
|
||||||
|
- env: BUILD_TYPE=default POLLER=select
|
||||||
|
os: linux
|
||||||
|
|
||||||
sudo: required
|
sudo: false
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- if [ $TRAVIS_OS_NAME == "osx" -a $BUILD_TYPE == "android" ] ; then brew update; brew install binutils ; fi
|
- if [ $TRAVIS_OS_NAME == "osx" -a $BUILD_TYPE == "android" ] ; then brew update; brew install binutils ; fi
|
||||||
|
@ -48,6 +48,10 @@ if [ $BUILD_TYPE == "default" ]; then
|
|||||||
CONFIG_OPTS+=("--with-norm=yes")
|
CONFIG_OPTS+=("--with-norm=yes")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -n "$POLLER" ]; then
|
||||||
|
CONFIG_OPTS+=("--with-poller=${POLLER}")
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z $DRAFT ] || [ $DRAFT == "disabled" ]; then
|
if [ -z $DRAFT ] || [ $DRAFT == "disabled" ]; then
|
||||||
CONFIG_OPTS+=("--enable-drafts=no")
|
CONFIG_OPTS+=("--enable-drafts=no")
|
||||||
elif [ $DRAFT == "enabled" ]; then
|
elif [ $DRAFT == "enabled" ]; then
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
zmq::io_thread_t::io_thread_t (ctx_t *ctx_, uint32_t tid_) :
|
zmq::io_thread_t::io_thread_t (ctx_t *ctx_, uint32_t tid_) :
|
||||||
object_t (ctx_, tid_),
|
object_t (ctx_, tid_),
|
||||||
mailbox_handle (NULL)
|
mailbox_handle ((poller_t::handle_t) NULL)
|
||||||
{
|
{
|
||||||
poller = new (std::nothrow) poller_t (*ctx_);
|
poller = new (std::nothrow) poller_t (*ctx_);
|
||||||
alloc_assert (poller);
|
alloc_assert (poller);
|
||||||
|
@ -48,6 +48,8 @@
|
|||||||
#include "i_poll_events.hpp"
|
#include "i_poll_events.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <limits>
|
||||||
|
#include <climits>
|
||||||
|
|
||||||
zmq::select_t::select_t (const zmq::ctx_t &ctx_) :
|
zmq::select_t::select_t (const zmq::ctx_t &ctx_) :
|
||||||
ctx (ctx_),
|
ctx (ctx_),
|
||||||
@ -211,7 +213,7 @@ void zmq::select_t::rm_fd (handle_t handle_)
|
|||||||
#else
|
#else
|
||||||
fd_entries_t::iterator fd_entry_it =
|
fd_entries_t::iterator fd_entry_it =
|
||||||
find_fd_entry_by_handle (family_entry.fd_entries, handle_);
|
find_fd_entry_by_handle (family_entry.fd_entries, handle_);
|
||||||
assert (fd_entry_it != fd_entries.end ());
|
assert (fd_entry_it != family_entry.fd_entries.end ());
|
||||||
|
|
||||||
zmq_assert (fd_entry_it->fd != retired_fd);
|
zmq_assert (fd_entry_it->fd != retired_fd);
|
||||||
fd_entry_it->fd = retired_fd;
|
fd_entry_it->fd = retired_fd;
|
||||||
@ -321,8 +323,6 @@ void zmq::select_t::loop ()
|
|||||||
(long) (timeout % 1000 * 1000)};
|
(long) (timeout % 1000 * 1000)};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int rc = 0;
|
|
||||||
|
|
||||||
#if defined ZMQ_HAVE_WINDOWS
|
#if defined ZMQ_HAVE_WINDOWS
|
||||||
/*
|
/*
|
||||||
On Windows select does not allow to mix descriptors from different
|
On Windows select does not allow to mix descriptors from different
|
||||||
@ -340,6 +340,7 @@ void zmq::select_t::loop ()
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// If there is just one family, there is no reason to use WSA events.
|
// If there is just one family, there is no reason to use WSA events.
|
||||||
|
int rc = 0;
|
||||||
const bool use_wsa_events = family_entries.size () > 1;
|
const bool use_wsa_events = family_entries.size () > 1;
|
||||||
if (use_wsa_events) {
|
if (use_wsa_events) {
|
||||||
// TODO: I don't really understand why we are doing this. If any of
|
// TODO: I don't really understand why we are doing this. If any of
|
||||||
|
@ -115,7 +115,11 @@ class select_t : public poller_base_t
|
|||||||
|
|
||||||
struct family_entry_t
|
struct family_entry_t
|
||||||
{
|
{
|
||||||
|
#ifndef ZMQ_HAVE_WINDOWS
|
||||||
|
family_entry_t () {};
|
||||||
|
#else
|
||||||
family_entry_t ();
|
family_entry_t ();
|
||||||
|
#endif
|
||||||
|
|
||||||
fd_entries_t fd_entries;
|
fd_entries_t fd_entries;
|
||||||
fds_set_t fds_set;
|
fds_set_t fds_set;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user