mirror of
https://github.com/zeromq/cppzmq.git
synced 2024-12-13 10:52:57 +01:00
Problem: zmq_fd_t not used/available in zmq (#452)
* Problem: zmq_fd_t not used/available in zmq Solution: Make zmq::fd_t available and use in poller_event * Deprecate typedef with comment
This commit is contained in:
parent
c591113bb7
commit
f428fee374
@ -270,8 +270,7 @@ TEST_CASE("socket check integral options", "[socket]")
|
|||||||
check_integral_opt_get<int>(zmq::sockopt::events, router, "events");
|
check_integral_opt_get<int>(zmq::sockopt::events, router, "events");
|
||||||
#endif
|
#endif
|
||||||
#ifdef ZMQ_FD
|
#ifdef ZMQ_FD
|
||||||
check_integral_opt_get<zmq::sockopt::cppzmq_fd_t>(zmq::sockopt::fd, router,
|
check_integral_opt_get<zmq::fd_t>(zmq::sockopt::fd, router, "fd");
|
||||||
"fd");
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef ZMQ_HANDSHAKE_IVL
|
#ifdef ZMQ_HANDSHAKE_IVL
|
||||||
check_integral_opt<int>(zmq::sockopt::handshake_ivl, router, "handshake_ivl");
|
check_integral_opt<int>(zmq::sockopt::handshake_ivl, router, "handshake_ivl");
|
||||||
|
35
zmq.hpp
35
zmq.hpp
@ -273,6 +273,17 @@ struct is_range<
|
|||||||
typedef zmq_free_fn free_fn;
|
typedef zmq_free_fn free_fn;
|
||||||
typedef zmq_pollitem_t pollitem_t;
|
typedef zmq_pollitem_t pollitem_t;
|
||||||
|
|
||||||
|
// duplicate definition from libzmq 4.3.3
|
||||||
|
#if defined _WIN32
|
||||||
|
#if defined _WIN64
|
||||||
|
typedef unsigned __int64 fd_t;
|
||||||
|
#else
|
||||||
|
typedef unsigned int fd_t;
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
typedef int fd_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
class error_t : public std::exception
|
class error_t : public std::exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -1351,10 +1362,6 @@ constexpr const_buffer operator"" _zbuf(const char32_t *str, size_t len) noexcep
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // ZMQ_CPP11
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef ZMQ_CPP11
|
|
||||||
namespace sockopt
|
namespace sockopt
|
||||||
{
|
{
|
||||||
// There are two types of options,
|
// There are two types of options,
|
||||||
@ -1390,16 +1397,8 @@ template<int Opt, int NullTerm = 1> struct array_option
|
|||||||
using NAME##_t = array_option<OPT, 2>; \
|
using NAME##_t = array_option<OPT, 2>; \
|
||||||
ZMQ_INLINE_VAR ZMQ_CONSTEXPR_VAR NAME##_t NAME {}
|
ZMQ_INLINE_VAR ZMQ_CONSTEXPR_VAR NAME##_t NAME {}
|
||||||
|
|
||||||
// duplicate definition from libzmq 4.3.3
|
// deprecated, use zmq::fd_t
|
||||||
#if defined _WIN32
|
using cppzmq_fd_t = ::zmq::fd_t;
|
||||||
#if defined _WIN64
|
|
||||||
typedef unsigned __int64 cppzmq_fd_t;
|
|
||||||
#else
|
|
||||||
typedef unsigned int cppzmq_fd_t;
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
typedef int cppzmq_fd_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ZMQ_AFFINITY
|
#ifdef ZMQ_AFFINITY
|
||||||
ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_AFFINITY, affinity, uint64_t);
|
ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_AFFINITY, affinity, uint64_t);
|
||||||
@ -1435,7 +1434,7 @@ ZMQ_DEFINE_ARRAY_OPT_BIN_OR_Z85(ZMQ_CURVE_SERVERKEY, curve_serverkey);
|
|||||||
ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_EVENTS, events, int);
|
ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_EVENTS, events, int);
|
||||||
#endif
|
#endif
|
||||||
#ifdef ZMQ_FD
|
#ifdef ZMQ_FD
|
||||||
ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_FD, fd, cppzmq_fd_t);
|
ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_FD, fd, ::zmq::fd_t);
|
||||||
#endif
|
#endif
|
||||||
#ifdef ZMQ_GSSAPI_PLAINTEXT
|
#ifdef ZMQ_GSSAPI_PLAINTEXT
|
||||||
ZMQ_DEFINE_INTEGRAL_BOOL_UNIT_OPT(ZMQ_GSSAPI_PLAINTEXT, gssapi_plaintext, int);
|
ZMQ_DEFINE_INTEGRAL_BOOL_UNIT_OPT(ZMQ_GSSAPI_PLAINTEXT, gssapi_plaintext, int);
|
||||||
@ -2587,11 +2586,7 @@ struct no_user_data;
|
|||||||
template<class T = no_user_data> struct poller_event
|
template<class T = no_user_data> struct poller_event
|
||||||
{
|
{
|
||||||
socket_ref socket;
|
socket_ref socket;
|
||||||
#ifdef _WIN32
|
::zmq::fd_t fd;
|
||||||
SOCKET fd;
|
|
||||||
#else
|
|
||||||
int fd;
|
|
||||||
#endif
|
|
||||||
T *user_data;
|
T *user_data;
|
||||||
event_flags events;
|
event_flags events;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user