Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
aff1f662
Commit
aff1f662
authored
Feb 19, 2010
by
Martin Sustrik
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of git@github.com:sustrik/zeromq2
parents
75f571c8
2a79a943
Show whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
208 additions
and
120 deletions
+208
-120
AUTHORS
AUTHORS
+2
-0
COPYING.LESSER
COPYING.LESSER
+15
-0
Makefile.am
Makefile.am
+1
-1
extconf.rb
bindings/ruby/extconf.rb
+6
-2
rbzmq.cpp
bindings/ruby/rbzmq.cpp
+34
-31
platform.hpp
builds/msvc/platform.hpp
+5
-0
configure.in
configure.in
+49
-20
Makefile.am
doc/Makefile.am
+2
-1
local_lat.rb
perf/ruby/local_lat.rb
+2
-2
local_thr.rb
perf/ruby/local_thr.rb
+3
-3
remote_lat.rb
perf/ruby/remote_lat.rb
+2
-2
remote_thr.rb
perf/ruby/remote_thr.rb
+2
-2
atomic_bitmap.hpp
src/atomic_bitmap.hpp
+8
-8
atomic_counter.hpp
src/atomic_counter.hpp
+7
-7
atomic_ptr.hpp
src/atomic_ptr.hpp
+7
-7
ip.cpp
src/ip.cpp
+2
-9
ip.hpp
src/ip.hpp
+10
-0
kqueue.cpp
src/kqueue.cpp
+14
-3
kqueue.hpp
src/kqueue.hpp
+2
-1
poll.cpp
src/poll.cpp
+2
-1
poll.hpp
src/poll.hpp
+2
-1
poller.hpp
src/poller.hpp
+2
-0
rep.cpp
src/rep.cpp
+12
-6
socket_base.cpp
src/socket_base.cpp
+9
-7
tcp_listener.cpp
src/tcp_listener.cpp
+1
-1
uuid.cpp
src/uuid.cpp
+1
-1
uuid.hpp
src/uuid.hpp
+2
-2
zmq.cpp
src/zmq.cpp
+4
-2
No files found.
AUTHORS
View file @
aff1f662
...
@@ -4,6 +4,7 @@ Contributors
...
@@ -4,6 +4,7 @@ Contributors
Alexej Lotz
Alexej Lotz
Asko Kauppi
Asko Kauppi
Barak Amar
Barak Amar
Chris Wong
Conrad D. Steenberg
Conrad D. Steenberg
Dhruva Krishnamurthy
Dhruva Krishnamurthy
Dirk O. Kaar
Dirk O. Kaar
...
@@ -18,6 +19,7 @@ Martin Hurton
...
@@ -18,6 +19,7 @@ Martin Hurton
Martin Lucina
Martin Lucina
Martin Sustrik
Martin Sustrik
Matus Hamorsky
Matus Hamorsky
McClain Looney
Pavel Gushcha
Pavel Gushcha
Pavol Malosek
Pavol Malosek
Steven McCoy
Steven McCoy
...
...
COPYING.LESSER
View file @
aff1f662
...
@@ -164,3 +164,18 @@ apply, that proxy's public statement of acceptance of any version is
...
@@ -164,3 +164,18 @@ apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
permanent authorization for you to choose that version for the
Library.
Library.
SPECIAL EXCEPTION GRANTED BY IMATIX
As a special exception, iMatix gives you permission to link this library with
independent modules to produce an executable, regardless of the license terms
of these independent modules, and to copy and distribute the resulting
executable under terms of your choice, provided that you also meet, for each
linked independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from or based on
this library. If you modify this library, you must extend this exception to your
version of the library.
Makefile.am
View file @
aff1f662
...
@@ -14,6 +14,6 @@ $(top_srcdir)/foreign/xmlParser/xmlParser.hpp
...
@@ -14,6 +14,6 @@ $(top_srcdir)/foreign/xmlParser/xmlParser.hpp
dist-hook
:
dist-hook
:
-
rm
-rf
$(distdir)
/foreign/openpgm/@pgm_basename@
-
rm
-rf
$(distdir)
/foreign/openpgm/@pgm_basename@
clean-local
:
dist
clean-local
:
-
rm
-rf
$(top_srcdir)
/foreign/openpgm/@pgm_basename@
-
rm
-rf
$(top_srcdir)
/foreign/openpgm/@pgm_basename@
bindings/ruby/extconf.rb
View file @
aff1f662
...
@@ -18,7 +18,11 @@
...
@@ -18,7 +18,11 @@
require
'mkmf'
require
'mkmf'
dir_config
(
'libzmq'
)
dir_config
(
'libzmq'
)
have_library
(
'libzmq'
)
if
have_library
(
'libzmq'
,
'zmq_init'
)
create_makefile
(
"ruby"
)
puts
"Cool, I found your zmq install..."
create_makefile
(
"zmq"
)
else
raise
"Couldn't find zmq library. try setting --with-zmq-dir=<path> to tell me where it is."
end
bindings/ruby/rbzmq.cpp
View file @
aff1f662
...
@@ -69,8 +69,8 @@ static VALUE socket_initialize (VALUE self_, VALUE context_, VALUE type_)
...
@@ -69,8 +69,8 @@ static VALUE socket_initialize (VALUE self_, VALUE context_, VALUE type_)
{
{
assert
(
!
DATA_PTR
(
self_
));
assert
(
!
DATA_PTR
(
self_
));
if
(
strcmp
(
rb_obj_classname
(
context_
),
"Context"
)
!=
0
)
{
if
(
strcmp
(
rb_obj_classname
(
context_
),
"
ZMQ::
Context"
)
!=
0
)
{
rb_raise
(
rb_eArgError
,
"expected Context object"
);
rb_raise
(
rb_eArgError
,
"expected
ZMQ::
Context object"
);
return
Qnil
;
return
Qnil
;
}
}
...
@@ -234,12 +234,15 @@ static VALUE socket_recv (VALUE self_, VALUE flags_)
...
@@ -234,12 +234,15 @@ static VALUE socket_recv (VALUE self_, VALUE flags_)
extern
"C"
void
Init_librbzmq
()
extern
"C"
void
Init_librbzmq
()
{
{
VALUE
context_type
=
rb_define_class
(
"Context"
,
rb_cObject
);
VALUE
zmq_module
=
rb_define_module
(
"ZMQ"
);
VALUE
context_type
=
rb_define_class_under
(
zmq_module
,
"Context"
,
rb_cObject
);
rb_define_alloc_func
(
context_type
,
context_alloc
);
rb_define_alloc_func
(
context_type
,
context_alloc
);
rb_define_method
(
context_type
,
"initialize"
,
rb_define_method
(
context_type
,
"initialize"
,
(
VALUE
(
*
)(...))
context_initialize
,
3
);
(
VALUE
(
*
)(...))
context_initialize
,
3
);
VALUE
socket_type
=
rb_define_class
(
"Socket"
,
rb_cObject
);
VALUE
socket_type
=
rb_define_class_under
(
zmq_module
,
"Socket"
,
rb_cObject
);
rb_define_alloc_func
(
socket_type
,
socket_alloc
);
rb_define_alloc_func
(
socket_type
,
socket_alloc
);
rb_define_method
(
socket_type
,
"initialize"
,
rb_define_method
(
socket_type
,
"initialize"
,
(
VALUE
(
*
)(...))
socket_initialize
,
2
);
(
VALUE
(
*
)(...))
socket_initialize
,
2
);
...
@@ -256,31 +259,31 @@ extern "C" void Init_librbzmq ()
...
@@ -256,31 +259,31 @@ extern "C" void Init_librbzmq ()
rb_define_method
(
socket_type
,
"recv"
,
rb_define_method
(
socket_type
,
"recv"
,
(
VALUE
(
*
)(...))
socket_recv
,
1
);
(
VALUE
(
*
)(...))
socket_recv
,
1
);
rb_define_
global_const
(
"HWM"
,
INT2NUM
(
ZMQ_HWM
));
rb_define_
const
(
zmq_module
,
"HWM"
,
INT2NUM
(
ZMQ_HWM
));
rb_define_
global_const
(
"LWM"
,
INT2NUM
(
ZMQ_LWM
));
rb_define_
const
(
zmq_module
,
"LWM"
,
INT2NUM
(
ZMQ_LWM
));
rb_define_
global_const
(
"SWAP"
,
INT2NUM
(
ZMQ_SWAP
));
rb_define_
const
(
zmq_module
,
"SWAP"
,
INT2NUM
(
ZMQ_SWAP
));
rb_define_
global_const
(
"AFFINITY"
,
INT2NUM
(
ZMQ_AFFINITY
));
rb_define_
const
(
zmq_module
,
"AFFINITY"
,
INT2NUM
(
ZMQ_AFFINITY
));
rb_define_
global_const
(
"IDENTITY"
,
INT2NUM
(
ZMQ_IDENTITY
));
rb_define_
const
(
zmq_module
,
"IDENTITY"
,
INT2NUM
(
ZMQ_IDENTITY
));
rb_define_
global_const
(
"SUBSCRIBE"
,
INT2NUM
(
ZMQ_SUBSCRIBE
));
rb_define_
const
(
zmq_module
,
"SUBSCRIBE"
,
INT2NUM
(
ZMQ_SUBSCRIBE
));
rb_define_
global_const
(
"UNSUBSCRIBE"
,
INT2NUM
(
ZMQ_UNSUBSCRIBE
));
rb_define_
const
(
zmq_module
,
"UNSUBSCRIBE"
,
INT2NUM
(
ZMQ_UNSUBSCRIBE
));
rb_define_
global_const
(
"RATE"
,
INT2NUM
(
ZMQ_RATE
));
rb_define_
const
(
zmq_module
,
"RATE"
,
INT2NUM
(
ZMQ_RATE
));
rb_define_
global_const
(
"RECOVERY_IVL"
,
INT2NUM
(
ZMQ_RECOVERY_IVL
));
rb_define_
const
(
zmq_module
,
"RECOVERY_IVL"
,
INT2NUM
(
ZMQ_RECOVERY_IVL
));
rb_define_
global_const
(
"MCAST_LOOP"
,
INT2NUM
(
ZMQ_MCAST_LOOP
));
rb_define_
const
(
zmq_module
,
"MCAST_LOOP"
,
INT2NUM
(
ZMQ_MCAST_LOOP
));
rb_define_
global_const
(
"SNDBUF"
,
INT2NUM
(
ZMQ_SNDBUF
));
rb_define_
const
(
zmq_module
,
"SNDBUF"
,
INT2NUM
(
ZMQ_SNDBUF
));
rb_define_
global_const
(
"RCVBUF"
,
INT2NUM
(
ZMQ_RCVBUF
));
rb_define_
const
(
zmq_module
,
"RCVBUF"
,
INT2NUM
(
ZMQ_RCVBUF
));
rb_define_
global_const
(
"NOBLOCK"
,
INT2NUM
(
ZMQ_NOBLOCK
));
rb_define_
const
(
zmq_module
,
"NOBLOCK"
,
INT2NUM
(
ZMQ_NOBLOCK
));
rb_define_
global_const
(
"NOFLUSH"
,
INT2NUM
(
ZMQ_NOFLUSH
));
rb_define_
const
(
zmq_module
,
"NOFLUSH"
,
INT2NUM
(
ZMQ_NOFLUSH
));
rb_define_
global_const
(
"P2P"
,
INT2NUM
(
ZMQ_P2P
));
rb_define_
const
(
zmq_module
,
"P2P"
,
INT2NUM
(
ZMQ_P2P
));
rb_define_
global_const
(
"SUB"
,
INT2NUM
(
ZMQ_SUB
));
rb_define_
const
(
zmq_module
,
"SUB"
,
INT2NUM
(
ZMQ_SUB
));
rb_define_
global_const
(
"PUB"
,
INT2NUM
(
ZMQ_PUB
));
rb_define_
const
(
zmq_module
,
"PUB"
,
INT2NUM
(
ZMQ_PUB
));
rb_define_
global_const
(
"REQ"
,
INT2NUM
(
ZMQ_REQ
));
rb_define_
const
(
zmq_module
,
"REQ"
,
INT2NUM
(
ZMQ_REQ
));
rb_define_
global_const
(
"REP"
,
INT2NUM
(
ZMQ_REP
));
rb_define_
const
(
zmq_module
,
"REP"
,
INT2NUM
(
ZMQ_REP
));
rb_define_
global_const
(
"XREQ"
,
INT2NUM
(
ZMQ_XREQ
));
rb_define_
const
(
zmq_module
,
"XREQ"
,
INT2NUM
(
ZMQ_XREQ
));
rb_define_
global_const
(
"XREP"
,
INT2NUM
(
ZMQ_XREP
));
rb_define_
const
(
zmq_module
,
"XREP"
,
INT2NUM
(
ZMQ_XREP
));
rb_define_
global_const
(
"UPSTREAM"
,
INT2NUM
(
ZMQ_UPSTREAM
));
rb_define_
const
(
zmq_module
,
"UPSTREAM"
,
INT2NUM
(
ZMQ_UPSTREAM
));
rb_define_
global_const
(
"DOWNSTREAM"
,
INT2NUM
(
ZMQ_DOWNSTREAM
));
rb_define_
const
(
zmq_module
,
"DOWNSTREAM"
,
INT2NUM
(
ZMQ_DOWNSTREAM
));
rb_define_
global_const
(
"POLL"
,
INT2NUM
(
ZMQ_POLL
));
rb_define_
const
(
zmq_module
,
"POLL"
,
INT2NUM
(
ZMQ_POLL
));
}
}
builds/msvc/platform.hpp
View file @
aff1f662
...
@@ -25,6 +25,11 @@
...
@@ -25,6 +25,11 @@
// zmq directory to take place of platform.hpp generated from
// zmq directory to take place of platform.hpp generated from
// platform.hpp.in on platforms supported by GNU autotools.
// platform.hpp.in on platforms supported by GNU autotools.
// 0MQ version information
#define PACKAGE_VERSION_MAJOR 2
#define PACKAGE_VERSION_MINOR 0
#define PACKAGE_VERSION_PATCH 6
#define ZMQ_HAVE_WINDOWS
#define ZMQ_HAVE_WINDOWS
#define _WINSOCKAPI_
#define _WINSOCKAPI_
#define NOMINMAX
#define NOMINMAX
...
...
configure.in
View file @
aff1f662
...
@@ -55,8 +55,14 @@ AC_PROG_SED
...
@@ -55,8 +55,14 @@ AC_PROG_SED
AC_PROG_AWK
AC_PROG_AWK
# Checks for libraries.
# Checks for libraries.
AC_CHECK_LIB(pthread, pthread_create)
AC_CHECK_LIB([pthread], [pthread_create])
AC_CHECK_LIB(stdc++, malloc)
# If using GNU C++, libstdc++ must be available.
if test "x$GXX" = "xyes"; then
# libstdc++ depends on libm on some platforms
AC_CHECK_LIB([m], [main])
AC_CHECK_LIB([stdc++], [main], ,
[AC_MSG_ERROR([cannot link with -lstdc++])])
fi
# Extra CXXFLAGS are appended at the end of CXXFLAGS for libzmq.
# Extra CXXFLAGS are appended at the end of CXXFLAGS for libzmq.
LIBZMQ_EXTRA_CXXFLAGS=""
LIBZMQ_EXTRA_CXXFLAGS=""
...
@@ -77,9 +83,9 @@ on_mingw32="no"
...
@@ -77,9 +83,9 @@ on_mingw32="no"
AC_CANONICAL_HOST
AC_CANONICAL_HOST
# Determine whether or not documentation should be built.
# Determine whether or not documentation should be built.
build_doc="
yes
"
build_doc="
no
"
install_man="yes"
install_man="yes"
if test
! -f "doc/zmq.html
"; then
if test
-d ".git
"; then
# We are building from git.
# We are building from git.
# Check for asciidoc and xmlto and don't build the docs if these are not installed.
# Check for asciidoc and xmlto and don't build the docs if these are not installed.
AC_CHECK_PROG(have_asciidoc, asciidoc, yes, no)
AC_CHECK_PROG(have_asciidoc, asciidoc, yes, no)
...
@@ -88,25 +94,40 @@ if test ! -f "doc/zmq.html"; then
...
@@ -88,25 +94,40 @@ if test ! -f "doc/zmq.html"; then
build_doc="no"
build_doc="no"
install_man="no"
install_man="no"
AC_MSG_WARN([You are building from git and asciidoc is not installed. Documentation will not be built or installed.])
AC_MSG_WARN([You are building from git and asciidoc is not installed. Documentation will not be built or installed.])
else
build_doc="yes"
fi
fi
fi
fi
AC_MSG_CHECKING([whether to build documentation])
AC_MSG_RESULT([$build_doc])
AC_MSG_CHECKING([whether to install manpages])
if test ! -f "./doc/zmq.7"; then
AC_MSG_ERROR([configure thinks we want to install manpages but they're not present. Help!])
fi
AC_MSG_RESULT([$install_man])
# Set some default features required by 0MQ code.
CPPFLAGS="-D_REENTRANT -D_THREAD_SAFE $CPPFLAGS"
# OS-specific tests
case "${host_os}" in
case "${host_os}" in
*linux*)
*linux*)
# Define on Linux to enable all library features
CPPFLAGS="-D_GNU_SOURCE $CPPFLAGS"
AC_DEFINE(ZMQ_HAVE_LINUX, 1, [Have Linux OS])
AC_DEFINE(ZMQ_HAVE_LINUX, 1, [Have Linux OS])
CPPFLAGS="-D_REENTRANT $CPPFLAGS"
AC_CHECK_LIB(uuid, main, ,
AC_CHECK_LIB(uuid, main, ,
[AC_MSG_ERROR([cannot link with -luuid, install uuid-dev.])])
[AC_MSG_ERROR([cannot link with -luuid, install uuid-dev.])])
;;
;;
*solaris*)
*solaris*)
# Define on Solaris to enable all library features
CPPFLAGS="-D_POSIX_C_SOURCE=200112L -D_PTHREADS $CPPFLAGS"
AC_DEFINE(ZMQ_HAVE_SOLARIS, 1, [Have Solaris OS])
AC_DEFINE(ZMQ_HAVE_SOLARIS, 1, [Have Solaris OS])
AC_CHECK_LIB(socket, main)
AC_CHECK_LIB(socket, main)
AC_CHECK_LIB(nsl, main)
AC_CHECK_LIB(nsl, main)
AC_CHECK_LIB(rt, main)
AC_CHECK_LIB(rt, main)
AC_CHECK_LIB(uuid, main, ,
AC_CHECK_LIB(uuid, main, ,
[AC_MSG_ERROR([cannot link with -luuid, install uuid-dev.])])
[AC_MSG_ERROR([cannot link with -luuid, install uuid-dev.])])
CPPFLAGS="-D_REENTRANT -D_PTHREADS $CPPFLAGS"
AC_MSG_CHECKING([whether atomic operations can be used])
AC_MSG_CHECKING([wheter atomic operations can be used])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[#include <atomic.h>]],
[[#include <atomic.h>]],
[[uint32_t value;
[[uint32_t value;
...
@@ -121,39 +142,48 @@ case "${host_os}" in
...
@@ -121,39 +142,48 @@ case "${host_os}" in
fi
fi
;;
;;
*freebsd*)
*freebsd*)
# Define on FreeBSD to enable all library features
CPPFLAGS="-D__BSD_VISIBLE $CPPFLAGS"
AC_DEFINE(ZMQ_HAVE_FREEBSD, 1, [Have FreeBSD OS])
AC_DEFINE(ZMQ_HAVE_FREEBSD, 1, [Have FreeBSD OS])
CPPFLAGS="-D_THREAD_SAFE $CPPFLAGS"
LIBS="-pthread"
;;
;;
*darwin*)
*darwin*)
# Define on Darwin to enable all library features
CPPFLAGS="-D_DARWIN_C_SOURCE $CPPFLAGS"
pedantic="no"
pedantic="no"
werror="no"
werror="no"
AC_DEFINE(ZMQ_HAVE_OSX, 1, [Have DarwinOSX OS])
AC_DEFINE(ZMQ_HAVE_OSX, 1, [Have DarwinOSX OS])
LIBS="-pthread"
LIBZMQ_EXTRA_CXXFLAGS+="-Wno-uninitialized"
LIBZMQ_EXTRA_CXXFLAGS+="-Wno-uninitialized"
;;
;;
*netbsd*)
# Define on NetBSD to enable all library features
CPPFLAGS="-D_NETBSD_SOURCE $CPPFLAGS"
AC_DEFINE(ZMQ_HAVE_NETBSD, 1, [Have NetBSD OS])
# NetBSD 5.0 and newer provides atomic operations
netbsd_has_atomic=no
# XXX As of 5.0.1 the functions declared in atomic.h are
# missing "extern C", disable this until upstream fixes it.
# AC_CHECK_HEADERS(atomic.h, [netbsd_has_atomic=yes])
if test "x$netbsd_has_atomic" = "xno"; then
AC_DEFINE(ZMQ_FORCE_MUTEXES, 1, [Force to use mutexes])
fi
;;
*openbsd*)
*openbsd*)
# Define on OpenBSD to enable all library features
CPPFLAGS="-D_BSD_SOURCE $CPPFLAGS"
AC_DEFINE(ZMQ_HAVE_OPENBSD, 1, [Have OpenBSD OS])
AC_DEFINE(ZMQ_HAVE_OPENBSD, 1, [Have OpenBSD OS])
CPPFLAGS="-pthread $CPPFLAGS"
LIBS="-pthread"
;;
;;
*nto-qnx*)
*nto-qnx*)
pedantic="no"
pedantic="no"
AC_DEFINE(ZMQ_HAVE_QNXNTO, 1, [Have QNX Neutrino OS])
AC_DEFINE(ZMQ_HAVE_QNXNTO, 1, [Have QNX Neutrino OS])
CPPFLAGS="-D_THREAD_SAFE $CPPFLAGS"
AC_CHECK_LIB(socket,main)
AC_CHECK_LIB(socket,main)
;;
;;
*aix*)
*aix*)
AC_DEFINE(ZMQ_HAVE_AIX, 1, [Have AIX OS])
AC_DEFINE(ZMQ_HAVE_AIX, 1, [Have AIX OS])
if test "x$GXX" = "xyes"; then
CPPFLAGS="-D_THREAD_SAFE $CPPFLAGS"
fi
;;
;;
*hpux*)
*hpux*)
# Define on HP-UX to enable all library features
CPPFLAGS="-D_POSIX_C_SOURCE=200112L"
AC_DEFINE(ZMQ_HAVE_HPUX, 1, [Have HPUX OS])
AC_DEFINE(ZMQ_HAVE_HPUX, 1, [Have HPUX OS])
if test "x$GXX" = "xyes"; then
CPPFLAGS="-D_THREAD_SAFE $CPPFLAGS"
fi
AC_CHECK_LIB(rt, main)
AC_CHECK_LIB(rt, main)
;;
;;
*mingw32*)
*mingw32*)
...
@@ -634,7 +664,6 @@ AC_MSG_RESULT([ Queue: $queue])
...
@@ -634,7 +664,6 @@ AC_MSG_RESULT([ Queue: $queue])
AC_MSG_RESULT([ Performance tests: $perf])
AC_MSG_RESULT([ Performance tests: $perf])
AC_MSG_RESULT([ Examples:])
AC_MSG_RESULT([ Examples:])
AC_MSG_RESULT([ Chat: $chat])
AC_MSG_RESULT([ Chat: $chat])
AC_MSG_RESULT([ Documentation: $build_doc])
AC_MSG_RESULT([])
AC_MSG_RESULT([])
AC_MSG_RESULT([ ******************************************************** ])
AC_MSG_RESULT([ ******************************************************** ])
AC_MSG_RESULT([])
AC_MSG_RESULT([])
...
...
doc/Makefile.am
View file @
aff1f662
...
@@ -26,6 +26,7 @@ MAINTAINERCLEANFILES = $(MAN_DOC) $(MAN_HTML)
...
@@ -26,6 +26,7 @@ MAINTAINERCLEANFILES = $(MAN_DOC) $(MAN_HTML)
dist-hook
:
$(MAN_DOC) $(MAN_HTML)
dist-hook
:
$(MAN_DOC) $(MAN_HTML)
if
BUILD_DOC
SUFFIXES
=
.html .txt .xml .1 .3 .7
SUFFIXES
=
.html .txt .xml .1 .3 .7
.txt.html
:
.txt.html
:
...
@@ -40,4 +41,4 @@ SUFFIXES=.html .txt .xml .1 .3 .7
...
@@ -40,4 +41,4 @@ SUFFIXES=.html .txt .xml .1 .3 .7
xmlto man
$<
xmlto man
$<
.xml.7
:
.xml.7
:
xmlto man
$<
xmlto man
$<
endif
perf/ruby/local_lat.rb
View file @
aff1f662
...
@@ -27,8 +27,8 @@ bind_to = ARGV[0]
...
@@ -27,8 +27,8 @@ bind_to = ARGV[0]
message_size
=
ARGV
[
1
].
to_i
message_size
=
ARGV
[
1
].
to_i
roundtrip_count
=
ARGV
[
2
].
to_i
roundtrip_count
=
ARGV
[
2
].
to_i
ctx
=
Context
.
new
(
1
,
1
,
0
)
ctx
=
ZMQ
::
Context
.
new
(
1
,
1
,
0
)
s
=
Socket
.
new
(
ctx
,
REP
);
s
=
ZMQ
::
Socket
.
new
(
ctx
,
ZMQ
::
REP
);
s
.
bind
(
bind_to
);
s
.
bind
(
bind_to
);
for
i
in
0
...
roundtrip_count
do
for
i
in
0
...
roundtrip_count
do
...
...
perf/ruby/local_thr.rb
View file @
aff1f662
...
@@ -27,9 +27,9 @@ bind_to = ARGV[0]
...
@@ -27,9 +27,9 @@ bind_to = ARGV[0]
message_size
=
ARGV
[
1
].
to_i
message_size
=
ARGV
[
1
].
to_i
message_count
=
ARGV
[
2
].
to_i
message_count
=
ARGV
[
2
].
to_i
ctx
=
Context
.
new
(
1
,
1
,
0
)
ctx
=
ZMQ
::
Context
.
new
(
1
,
1
,
0
)
s
=
Socket
.
new
(
ctx
,
SUB
);
s
=
ZMQ
::
Socket
.
new
(
ctx
,
ZMQ
::
SUB
);
s
.
setsockopt
(
SUBSCRIBE
,
""
);
s
.
setsockopt
(
ZMQ
::
SUBSCRIBE
,
""
);
# Add your socket options here.
# Add your socket options here.
# For example ZMQ_RATE, ZMQ_RECOVERY_IVL and ZMQ_MCAST_LOOP for PGM.
# For example ZMQ_RATE, ZMQ_RECOVERY_IVL and ZMQ_MCAST_LOOP for PGM.
...
...
perf/ruby/remote_lat.rb
View file @
aff1f662
...
@@ -27,8 +27,8 @@ connect_to = ARGV[0]
...
@@ -27,8 +27,8 @@ connect_to = ARGV[0]
message_size
=
ARGV
[
1
].
to_i
message_size
=
ARGV
[
1
].
to_i
roundtrip_count
=
ARGV
[
2
].
to_i
roundtrip_count
=
ARGV
[
2
].
to_i
ctx
=
Context
.
new
(
1
,
1
,
0
)
ctx
=
ZMQ
::
Context
.
new
(
1
,
1
,
0
)
s
=
Socket
.
new
(
ctx
,
REQ
);
s
=
ZMQ
::
Socket
.
new
(
ctx
,
ZMQ
::
REQ
);
s
.
connect
(
connect_to
);
s
.
connect
(
connect_to
);
msg
=
"
#{
'0'
*
message_size
}
"
msg
=
"
#{
'0'
*
message_size
}
"
...
...
perf/ruby/remote_thr.rb
View file @
aff1f662
...
@@ -27,8 +27,8 @@ connect_to = ARGV[0]
...
@@ -27,8 +27,8 @@ connect_to = ARGV[0]
message_size
=
ARGV
[
1
].
to_i
message_size
=
ARGV
[
1
].
to_i
message_count
=
ARGV
[
2
].
to_i
message_count
=
ARGV
[
2
].
to_i
ctx
=
Context
.
new
(
1
,
1
,
0
)
ctx
=
ZMQ
::
Context
.
new
(
1
,
1
,
0
)
s
=
Socket
.
new
(
ctx
,
PUB
);
s
=
ZMQ
::
Socket
.
new
(
ctx
,
ZMQ
::
PUB
);
# Add your socket options here.
# Add your socket options here.
# For example ZMQ_RATE, ZMQ_RECOVERY_IVL and ZMQ_MCAST_LOOP for PGM.
# For example ZMQ_RATE, ZMQ_RECOVERY_IVL and ZMQ_MCAST_LOOP for PGM.
...
...
src/atomic_bitmap.hpp
View file @
aff1f662
...
@@ -34,8 +34,8 @@
...
@@ -34,8 +34,8 @@
#define ZMQ_ATOMIC_BITMAP_SPARC
#define ZMQ_ATOMIC_BITMAP_SPARC
#elif defined ZMQ_HAVE_WINDOWS
#elif defined ZMQ_HAVE_WINDOWS
#define ZMQ_ATOMIC_BITMAP_WINDOWS
#define ZMQ_ATOMIC_BITMAP_WINDOWS
#elif
defined ZMQ_HAVE_SOLARIS
#elif
(defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_NETBSD)
#define ZMQ_ATOMIC_BITMAP_S
OLARIS
#define ZMQ_ATOMIC_BITMAP_S
YSTEM
#else
#else
#define ZMQ_ATOMIC_BITMAP_MUTEX
#define ZMQ_ATOMIC_BITMAP_MUTEX
#endif
#endif
...
@@ -44,7 +44,7 @@
...
@@ -44,7 +44,7 @@
#include "mutex.hpp"
#include "mutex.hpp"
#elif defined ZMQ_ATOMIC_BITMAP_WINDOWS
#elif defined ZMQ_ATOMIC_BITMAP_WINDOWS
#include "windows.hpp"
#include "windows.hpp"
#elif defined ZMQ_ATOMIC_BITMAP_S
OLARIS
#elif defined ZMQ_ATOMIC_BITMAP_S
YSTEM
#include <atomic.h>
#include <atomic.h>
#endif
#endif
...
@@ -89,7 +89,7 @@ namespace zmq
...
@@ -89,7 +89,7 @@ namespace zmq
return
(
oldval
&
(
bitmap_t
(
1
)
<<
reset_index_
))
?
return
(
oldval
&
(
bitmap_t
(
1
)
<<
reset_index_
))
?
true
:
false
;
true
:
false
;
}
}
#elif defined ZMQ_ATOMIC_BITMAP_S
OLARIS
#elif defined ZMQ_ATOMIC_BITMAP_S
YSTEM
while
(
true
)
{
while
(
true
)
{
bitmap_t
oldval
=
value
;
bitmap_t
oldval
=
value
;
bitmap_t
newval
=
(
oldval
|
(
bitmap_t
(
1
)
<<
set_index_
))
&
bitmap_t
newval
=
(
oldval
|
(
bitmap_t
(
1
)
<<
set_index_
))
&
...
@@ -150,7 +150,7 @@ namespace zmq
...
@@ -150,7 +150,7 @@ namespace zmq
bitmap_t
oldval
;
bitmap_t
oldval
;
#if defined ZMQ_ATOMIC_BITMAP_WINDOWS
#if defined ZMQ_ATOMIC_BITMAP_WINDOWS
oldval
=
InterlockedExchange
((
volatile
LONG
*
)
&
value
,
newval_
);
oldval
=
InterlockedExchange
((
volatile
LONG
*
)
&
value
,
newval_
);
#elif defined ZMQ_ATOMIC_BITMAP_S
OLARIS
#elif defined ZMQ_ATOMIC_BITMAP_S
YSTEM
oldval
=
atomic_swap_32
(
&
value
,
newval_
);
oldval
=
atomic_swap_32
(
&
value
,
newval_
);
#elif defined ZMQ_ATOMIC_BITMAP_X86
#elif defined ZMQ_ATOMIC_BITMAP_X86
oldval
=
newval_
;
oldval
=
newval_
;
...
@@ -201,7 +201,7 @@ namespace zmq
...
@@ -201,7 +201,7 @@ namespace zmq
newval
,
oldval
)
==
(
LONG
)
oldval
)
newval
,
oldval
)
==
(
LONG
)
oldval
)
return
oldval
;
return
oldval
;
}
}
#elif defined ZMQ_ATOMIC_BITMAP_S
OLARIS
#elif defined ZMQ_ATOMIC_BITMAP_S
YSTEM
while
(
true
)
{
while
(
true
)
{
bitmap_t
oldval
=
value
;
bitmap_t
oldval
=
value
;
bitmap_t
newval
=
oldval
==
0
?
thenval_
:
elseval_
;
bitmap_t
newval
=
oldval
==
0
?
thenval_
:
elseval_
;
...
@@ -270,8 +270,8 @@ namespace zmq
...
@@ -270,8 +270,8 @@ namespace zmq
#if defined ZMQ_ATOMIC_BITMAP_WINDOWS
#if defined ZMQ_ATOMIC_BITMAP_WINDOWS
#undef ZMQ_ATOMIC_BITMAP_WINDOWS
#undef ZMQ_ATOMIC_BITMAP_WINDOWS
#endif
#endif
#if defined ZMQ_ATOMIC_BITMAP_S
OLARIS
#if defined ZMQ_ATOMIC_BITMAP_S
YSTEM
#undef ZMQ_ATOMIC_BITMAP_S
OLARIS
#undef ZMQ_ATOMIC_BITMAP_S
YSTEM
#endif
#endif
#if defined ZMQ_ATOMIC_BITMAP_X86
#if defined ZMQ_ATOMIC_BITMAP_X86
#undef ZMQ_ATOMIC_BITMAP_X86
#undef ZMQ_ATOMIC_BITMAP_X86
...
...
src/atomic_counter.hpp
View file @
aff1f662
...
@@ -31,8 +31,8 @@
...
@@ -31,8 +31,8 @@
#define ZMQ_ATOMIC_COUNTER_SPARC
#define ZMQ_ATOMIC_COUNTER_SPARC
#elif defined ZMQ_HAVE_WINDOWS
#elif defined ZMQ_HAVE_WINDOWS
#define ZMQ_ATOMIC_COUNTER_WINDOWS
#define ZMQ_ATOMIC_COUNTER_WINDOWS
#elif
defined ZMQ_HAVE_SOLARIS
#elif
(defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_NETBSD)
#define ZMQ_ATOMIC_COUNTER_S
OLARIS
#define ZMQ_ATOMIC_COUNTER_S
YSTEM
#else
#else
#define ZMQ_ATOMIC_COUNTER_MUTEX
#define ZMQ_ATOMIC_COUNTER_MUTEX
#endif
#endif
...
@@ -41,7 +41,7 @@
...
@@ -41,7 +41,7 @@
#include "mutex.hpp"
#include "mutex.hpp"
#elif defined ZMQ_ATOMIC_COUNTER_WINDOWS
#elif defined ZMQ_ATOMIC_COUNTER_WINDOWS
#include "windows.hpp"
#include "windows.hpp"
#elif defined ZMQ_ATOMIC_COUNTER_S
OLARIS
#elif defined ZMQ_ATOMIC_COUNTER_S
YSTEM
#include <atomic.h>
#include <atomic.h>
#endif
#endif
...
@@ -79,7 +79,7 @@ namespace zmq
...
@@ -79,7 +79,7 @@ namespace zmq
#if defined ZMQ_ATOMIC_COUNTER_WINDOWS
#if defined ZMQ_ATOMIC_COUNTER_WINDOWS
old_value
=
InterlockedExchangeAdd
((
LONG
*
)
&
value
,
increment_
);
old_value
=
InterlockedExchangeAdd
((
LONG
*
)
&
value
,
increment_
);
#elif defined ZMQ_ATOMIC_COUNTER_S
OLARIS
#elif defined ZMQ_ATOMIC_COUNTER_S
YSTEM
integer_t
new_value
=
atomic_add_32_nv
(
&
value
,
increment_
);
integer_t
new_value
=
atomic_add_32_nv
(
&
value
,
increment_
);
old_value
=
new_value
-
increment_
;
old_value
=
new_value
-
increment_
;
#elif defined ZMQ_ATOMIC_COUNTER_X86
#elif defined ZMQ_ATOMIC_COUNTER_X86
...
@@ -119,7 +119,7 @@ namespace zmq
...
@@ -119,7 +119,7 @@ namespace zmq
LONG
delta
=
-
((
LONG
)
decrement
);
LONG
delta
=
-
((
LONG
)
decrement
);
integer_t
old
=
InterlockedExchangeAdd
((
LONG
*
)
&
value
,
delta
);
integer_t
old
=
InterlockedExchangeAdd
((
LONG
*
)
&
value
,
delta
);
return
old
-
decrement
!=
0
;
return
old
-
decrement
!=
0
;
#elif defined ZMQ_ATOMIC_COUNTER_S
OLARIS
#elif defined ZMQ_ATOMIC_COUNTER_S
YSTEM
int32_t
delta
=
-
((
int32_t
)
decrement
);
int32_t
delta
=
-
((
int32_t
)
decrement
);
integer_t
nv
=
atomic_add_32_nv
(
&
value
,
delta
);
integer_t
nv
=
atomic_add_32_nv
(
&
value
,
delta
);
return
nv
!=
0
;
return
nv
!=
0
;
...
@@ -180,8 +180,8 @@ namespace zmq
...
@@ -180,8 +180,8 @@ namespace zmq
#if defined ZMQ_ATOMIC_COUNTER_WINDOWS
#if defined ZMQ_ATOMIC_COUNTER_WINDOWS
#undef ZMQ_ATOMIC_COUNTER_WINDOWS
#undef ZMQ_ATOMIC_COUNTER_WINDOWS
#endif
#endif
#if defined ZMQ_ATOMIC_COUNTER_S
OLARIS
#if defined ZMQ_ATOMIC_COUNTER_S
YSTEM
#undef ZMQ_ATOMIC_COUNTER_S
OLARIS
#undef ZMQ_ATOMIC_COUNTER_S
YSTEM
#endif
#endif
#if defined ZMQ_ATOMIC_COUNTER_X86
#if defined ZMQ_ATOMIC_COUNTER_X86
#undef ZMQ_ATOMIC_COUNTER_X86
#undef ZMQ_ATOMIC_COUNTER_X86
...
...
src/atomic_ptr.hpp
View file @
aff1f662
...
@@ -31,8 +31,8 @@
...
@@ -31,8 +31,8 @@
#define ZMQ_ATOMIC_PTR_SPARC
#define ZMQ_ATOMIC_PTR_SPARC
#elif defined ZMQ_HAVE_WINDOWS
#elif defined ZMQ_HAVE_WINDOWS
#define ZMQ_ATOMIC_PTR_WINDOWS
#define ZMQ_ATOMIC_PTR_WINDOWS
#elif
defined ZMQ_HAVE_SOLARIS
#elif
(defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_NETBSD)
#define ZMQ_ATOMIC_PTR_S
OLARIS
#define ZMQ_ATOMIC_PTR_S
YSTEM
#else
#else
#define ZMQ_ATOMIC_PTR_MUTEX
#define ZMQ_ATOMIC_PTR_MUTEX
#endif
#endif
...
@@ -41,7 +41,7 @@
...
@@ -41,7 +41,7 @@
#include "mutex.hpp"
#include "mutex.hpp"
#elif defined ZMQ_ATOMIC_PTR_WINDOWS
#elif defined ZMQ_ATOMIC_PTR_WINDOWS
#include "windows.hpp"
#include "windows.hpp"
#elif defined ZMQ_ATOMIC_PTR_S
OLARIS
#elif defined ZMQ_ATOMIC_PTR_S
YSTEM
#include <atomic.h>
#include <atomic.h>
#endif
#endif
...
@@ -79,7 +79,7 @@ namespace zmq
...
@@ -79,7 +79,7 @@ namespace zmq
{
{
#if defined ZMQ_ATOMIC_PTR_WINDOWS
#if defined ZMQ_ATOMIC_PTR_WINDOWS
return
(
T
*
)
InterlockedExchangePointer
(
&
ptr
,
val_
);
return
(
T
*
)
InterlockedExchangePointer
(
&
ptr
,
val_
);
#elif defined ZMQ_ATOMIC_PTR_S
OLARIS
#elif defined ZMQ_ATOMIC_PTR_S
YSTEM
return
(
T
*
)
atomic_swap_ptr
(
&
ptr
,
val_
);
return
(
T
*
)
atomic_swap_ptr
(
&
ptr
,
val_
);
#elif defined ZMQ_ATOMIC_PTR_X86
#elif defined ZMQ_ATOMIC_PTR_X86
T
*
old
;
T
*
old
;
...
@@ -125,7 +125,7 @@ namespace zmq
...
@@ -125,7 +125,7 @@ namespace zmq
#if defined ZMQ_ATOMIC_PTR_WINDOWS
#if defined ZMQ_ATOMIC_PTR_WINDOWS
return
(
T
*
)
InterlockedCompareExchangePointer
(
return
(
T
*
)
InterlockedCompareExchangePointer
(
(
volatile
PVOID
*
)
&
ptr
,
val_
,
cmp_
);
(
volatile
PVOID
*
)
&
ptr
,
val_
,
cmp_
);
#elif defined ZMQ_ATOMIC_PTR_S
OLARIS
#elif defined ZMQ_ATOMIC_PTR_S
YSTEM
return
(
T
*
)
atomic_cas_ptr
(
&
ptr
,
cmp_
,
val_
);
return
(
T
*
)
atomic_cas_ptr
(
&
ptr
,
cmp_
,
val_
);
#elif defined ZMQ_ATOMIC_PTR_X86
#elif defined ZMQ_ATOMIC_PTR_X86
T
*
old
;
T
*
old
;
...
@@ -173,8 +173,8 @@ namespace zmq
...
@@ -173,8 +173,8 @@ namespace zmq
#if defined ZMQ_ATOMIC_PTR_WINDOWS
#if defined ZMQ_ATOMIC_PTR_WINDOWS
#undef ZMQ_ATOMIC_PTR_WINDOWS
#undef ZMQ_ATOMIC_PTR_WINDOWS
#endif
#endif
#if defined ZMQ_ATOMIC_PTR_S
OLARIS
#if defined ZMQ_ATOMIC_PTR_S
YSTEM
#undef ZMQ_ATOMIC_PTR_S
OLARIS
#undef ZMQ_ATOMIC_PTR_S
YSTEM
#endif
#endif
#if defined ZMQ_ATOMIC_PTR_X86
#if defined ZMQ_ATOMIC_PTR_X86
#undef ZMQ_ATOMIC_PTR_X86
#undef ZMQ_ATOMIC_PTR_X86
...
...
src/ip.cpp
View file @
aff1f662
...
@@ -125,7 +125,8 @@ static int resolve_nic_name (in_addr* addr_, char const *interface_)
...
@@ -125,7 +125,8 @@ static int resolve_nic_name (in_addr* addr_, char const *interface_)
#elif ((defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_FREEBSD ||\
#elif ((defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_FREEBSD ||\
defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_OPENBSD ||\
defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_OPENBSD ||\
defined ZMQ_HAVE_QNXNTO) && defined ZMQ_HAVE_IFADDRS)
defined ZMQ_HAVE_QNXNTO || defined ZMQ_HAVE_NETBSD)\
&& defined ZMQ_HAVE_IFADDRS)
#include <ifaddrs.h>
#include <ifaddrs.h>
...
@@ -239,11 +240,7 @@ int zmq::resolve_ip_interface (sockaddr_storage* addr_, socklen_t *addr_len_,
...
@@ -239,11 +240,7 @@ int zmq::resolve_ip_interface (sockaddr_storage* addr_, socklen_t *addr_len_,
// Restrict hostname/service to literals to avoid any DNS lookups or
// Restrict hostname/service to literals to avoid any DNS lookups or
// service-name irregularity due to indeterminate socktype.
// service-name irregularity due to indeterminate socktype.
#if defined ZMQ_HAVE_OSX
req
.
ai_flags
=
AI_PASSIVE
|
AI_NUMERICHOST
;
#else
req
.
ai_flags
=
AI_PASSIVE
|
AI_NUMERICHOST
|
AI_NUMERICSERV
;
req
.
ai_flags
=
AI_PASSIVE
|
AI_NUMERICHOST
|
AI_NUMERICSERV
;
#endif
// Resolve the literal address. Some of the error info is lost in case
// Resolve the literal address. Some of the error info is lost in case
// of error, however, there's no way to report EAI errors via errno.
// of error, however, there's no way to report EAI errors via errno.
...
@@ -292,11 +289,7 @@ int zmq::resolve_ip_hostname (sockaddr_storage *addr_, socklen_t *addr_len_,
...
@@ -292,11 +289,7 @@ int zmq::resolve_ip_hostname (sockaddr_storage *addr_, socklen_t *addr_len_,
// Avoid named services due to unclear socktype, and don't pick IPv6
// Avoid named services due to unclear socktype, and don't pick IPv6
// addresses if we don't have a local IPv6 address configured.
// addresses if we don't have a local IPv6 address configured.
#if defined ZMQ_HAVE_OSX
req
.
ai_flags
=
AI_ADDRCONFIG
;
#else
req
.
ai_flags
=
AI_NUMERICSERV
|
AI_ADDRCONFIG
;
req
.
ai_flags
=
AI_NUMERICSERV
|
AI_ADDRCONFIG
;
#endif
// Resolve host name. Some of the error info is lost in case of error,
// Resolve host name. Some of the error info is lost in case of error,
// however, there's no way to report EAI errors via errno.
// however, there's no way to report EAI errors via errno.
...
...
src/ip.hpp
View file @
aff1f662
...
@@ -30,6 +30,16 @@
...
@@ -30,6 +30,16 @@
#include <arpa/inet.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netinet/in.h>
#include <netdb.h>
#include <netdb.h>
// Some platforms (notably Darwin/OSX and NetBSD) do not define all AI_
// flags for getaddrinfo(). This can be worked around safely by defining
// these to 0.
#ifndef AI_ADDRCONFIG
#define AI_ADDRCONFIG 0
#endif
#ifndef AI_NUMERICSERV
#define AI_NUMERICSERV 0
#endif
#endif
#endif
#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS
#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS
...
...
src/kqueue.cpp
View file @
aff1f662
...
@@ -19,7 +19,8 @@
...
@@ -19,7 +19,8 @@
#include "platform.hpp"
#include "platform.hpp"
#if defined ZMQ_HAVE_FREEBSD || defined ZMQ_HAVE_OPENBSD || defined ZMQ_HAVE_OSX
#if defined ZMQ_HAVE_FREEBSD || defined ZMQ_HAVE_OPENBSD ||\
defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_NETBSD
#include <sys/time.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/types.h>
...
@@ -34,6 +35,14 @@
...
@@ -34,6 +35,14 @@
#include "config.hpp"
#include "config.hpp"
#include "i_poll_events.hpp"
#include "i_poll_events.hpp"
// NetBSD defines (struct kevent).udata as intptr_t, everyone else
// as void *.
#if defined ZMQ_HAVE_NETBSD
#define kevent_udata_t intptr_t
#else
#define kevent_udata_t void *
#endif
zmq
::
kqueue_t
::
kqueue_t
()
:
zmq
::
kqueue_t
::
kqueue_t
()
:
stopping
(
false
)
stopping
(
false
)
{
{
...
@@ -56,7 +65,7 @@ void zmq::kqueue_t::kevent_add (fd_t fd_, short filter_, void *udata_)
...
@@ -56,7 +65,7 @@ void zmq::kqueue_t::kevent_add (fd_t fd_, short filter_, void *udata_)
{
{
struct
kevent
ev
;
struct
kevent
ev
;
EV_SET
(
&
ev
,
fd_
,
filter_
,
EV_ADD
,
0
,
0
,
udata_
);
EV_SET
(
&
ev
,
fd_
,
filter_
,
EV_ADD
,
0
,
0
,
(
kevent_udata_t
)
udata_
);
int
rc
=
kevent
(
kqueue_fd
,
&
ev
,
1
,
NULL
,
0
,
NULL
);
int
rc
=
kevent
(
kqueue_fd
,
&
ev
,
1
,
NULL
,
0
,
NULL
);
errno_assert
(
rc
!=
-
1
);
errno_assert
(
rc
!=
-
1
);
}
}
...
@@ -65,7 +74,7 @@ void zmq::kqueue_t::kevent_delete (fd_t fd_, short filter_)
...
@@ -65,7 +74,7 @@ void zmq::kqueue_t::kevent_delete (fd_t fd_, short filter_)
{
{
struct
kevent
ev
;
struct
kevent
ev
;
EV_SET
(
&
ev
,
fd_
,
filter_
,
EV_DELETE
,
0
,
0
,
NULL
);
EV_SET
(
&
ev
,
fd_
,
filter_
,
EV_DELETE
,
0
,
0
,
(
kevent_udata_t
)
NULL
);
int
rc
=
kevent
(
kqueue_fd
,
&
ev
,
1
,
NULL
,
0
,
NULL
);
int
rc
=
kevent
(
kqueue_fd
,
&
ev
,
1
,
NULL
,
0
,
NULL
);
errno_assert
(
rc
!=
-
1
);
errno_assert
(
rc
!=
-
1
);
}
}
...
@@ -212,4 +221,6 @@ void zmq::kqueue_t::worker_routine (void *arg_)
...
@@ -212,4 +221,6 @@ void zmq::kqueue_t::worker_routine (void *arg_)
((
kqueue_t
*
)
arg_
)
->
loop
();
((
kqueue_t
*
)
arg_
)
->
loop
();
}
}
// Don't pollute namespace with defines local to this file
#undef kevent_udata_t
#endif
#endif
src/kqueue.hpp
View file @
aff1f662
...
@@ -22,7 +22,8 @@
...
@@ -22,7 +22,8 @@
#include "platform.hpp"
#include "platform.hpp"
#if defined ZMQ_HAVE_FREEBSD || defined ZMQ_HAVE_OPENBSD || defined ZMQ_HAVE_OSX
#if defined ZMQ_HAVE_FREEBSD || defined ZMQ_HAVE_OPENBSD ||\
defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_NETBSD
#include <vector>
#include <vector>
...
...
src/poll.cpp
View file @
aff1f662
...
@@ -22,7 +22,8 @@
...
@@ -22,7 +22,8 @@
#if defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_FREEBSD ||\
#if defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_FREEBSD ||\
defined ZMQ_HAVE_OPENBSD || defined ZMQ_HAVE_SOLARIS ||\
defined ZMQ_HAVE_OPENBSD || defined ZMQ_HAVE_SOLARIS ||\
defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_QNXNTO ||\
defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_QNXNTO ||\
defined ZMQ_HAVE_HPUX || defined ZMQ_HAVE_AIX
defined ZMQ_HAVE_HPUX || defined ZMQ_HAVE_AIX ||\
defined ZMQ_HAVE_NETBSD
#include <sys/types.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/time.h>
...
...
src/poll.hpp
View file @
aff1f662
...
@@ -25,7 +25,8 @@
...
@@ -25,7 +25,8 @@
#if defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_FREEBSD ||\
#if defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_FREEBSD ||\
defined ZMQ_HAVE_OPENBSD || defined ZMQ_HAVE_SOLARIS ||\
defined ZMQ_HAVE_OPENBSD || defined ZMQ_HAVE_SOLARIS ||\
defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_QNXNTO ||\
defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_QNXNTO ||\
defined ZMQ_HAVE_HPUX || defined ZMQ_HAVE_AIX
defined ZMQ_HAVE_HPUX || defined ZMQ_HAVE_AIX ||\
defined ZMQ_HAVE_NETBSD
#include <poll.h>
#include <poll.h>
#include <stddef.h>
#include <stddef.h>
...
...
src/poller.hpp
View file @
aff1f662
...
@@ -47,6 +47,8 @@ namespace zmq
...
@@ -47,6 +47,8 @@ namespace zmq
typedef
kqueue_t
poller_t
;
typedef
kqueue_t
poller_t
;
#elif defined ZMQ_HAVE_OPENBSD
#elif defined ZMQ_HAVE_OPENBSD
typedef
kqueue_t
poller_t
;
typedef
kqueue_t
poller_t
;
#elif defined ZMQ_HAVE_NETBSD
typedef
kqueue_t
poller_t
;
#elif defined ZMQ_HAVE_SOLARIS
#elif defined ZMQ_HAVE_SOLARIS
typedef
devpoll_t
poller_t
;
typedef
devpoll_t
poller_t
;
#elif defined ZMQ_HAVE_OSX
#elif defined ZMQ_HAVE_OSX
...
...
src/rep.cpp
View file @
aff1f662
...
@@ -89,11 +89,11 @@ void zmq::rep_t::xdetach_outpipe (class writer_t *pipe_)
...
@@ -89,11 +89,11 @@ void zmq::rep_t::xdetach_outpipe (class writer_t *pipe_)
out_pipes_t
::
size_type
index
=
out_pipes
.
index
(
pipe_
);
out_pipes_t
::
size_type
index
=
out_pipes
.
index
(
pipe_
);
//
TODO:
If the connection we've got the request from disconnects,
// If the connection we've got the request from disconnects,
// there's nowhere to send the reply.
DLQ?
// there's nowhere to send the reply.
Forget about the reply pipe.
if
(
waiting_for_reply
&&
pipe_
==
reply_pipe
)
{
// Once the reply is sent it will be dropped.
zmq_assert
(
false
);
if
(
waiting_for_reply
&&
pipe_
==
reply_pipe
)
}
reply_pipe
=
NULL
;
// If corresponding inpipe is still in place simply nullify the pointer
// If corresponding inpipe is still in place simply nullify the pointer
// to the outpipe.
// to the outpipe.
...
@@ -150,9 +150,15 @@ int zmq::rep_t::xsend (zmq_msg_t *msg_, int flags_)
...
@@ -150,9 +150,15 @@ int zmq::rep_t::xsend (zmq_msg_t *msg_, int flags_)
// overloads the buffer, connection should be torn down.
// overloads the buffer, connection should be torn down.
zmq_assert
(
reply_pipe
->
check_write
(
zmq_msg_size
(
msg_
)));
zmq_assert
(
reply_pipe
->
check_write
(
zmq_msg_size
(
msg_
)));
// Push message to the selected pipe.
// Push message to the selected pipe. If requester have disconnected
// in the meantime, drop the reply.
if
(
reply_pipe
)
{
reply_pipe
->
write
(
msg_
);
reply_pipe
->
write
(
msg_
);
reply_pipe
->
flush
();
reply_pipe
->
flush
();
}
else
{
zmq_close
(
msg_
);
}
waiting_for_reply
=
false
;
waiting_for_reply
=
false
;
reply_pipe
=
NULL
;
reply_pipe
=
NULL
;
...
...
src/socket_base.cpp
View file @
aff1f662
...
@@ -346,6 +346,7 @@ int zmq::socket_base_t::recv (::zmq_msg_t *msg_, int flags_)
...
@@ -346,6 +346,7 @@ int zmq::socket_base_t::recv (::zmq_msg_t *msg_, int flags_)
{
{
// Get the message.
// Get the message.
int
rc
=
xrecv
(
msg_
,
flags_
);
int
rc
=
xrecv
(
msg_
,
flags_
);
int
err
=
errno
;
// Once every inbound_poll_rate messages check for signals and process
// Once every inbound_poll_rate messages check for signals and process
// incoming commands. This happens only if we are not polling altogether
// incoming commands. This happens only if we are not polling altogether
...
@@ -364,19 +365,22 @@ int zmq::socket_base_t::recv (::zmq_msg_t *msg_, int flags_)
...
@@ -364,19 +365,22 @@ int zmq::socket_base_t::recv (::zmq_msg_t *msg_, int flags_)
if
(
rc
==
0
)
if
(
rc
==
0
)
return
0
;
return
0
;
// If we don't have the message, restore the original cause of the problem.
errno
=
err
;
// If the message cannot be fetched immediately, there are two scenarios.
// If the message cannot be fetched immediately, there are two scenarios.
// For non-blocking recv, commands are processed in case there's a revive
// For non-blocking recv, commands are processed in case there's a revive
// command already waiting int a command pipe. If it's not, return EAGAIN.
// command already waiting int a command pipe. If it's not, return EAGAIN.
// In blocking scenario, commands are processed over and over again until
// we are able to fetch a message.
if
(
flags_
&
ZMQ_NOBLOCK
)
{
if
(
flags_
&
ZMQ_NOBLOCK
)
{
if
(
errno
!=
EAGAIN
)
if
(
errno
!=
EAGAIN
)
return
-
1
;
return
-
1
;
app_thread
->
process_commands
(
false
,
false
);
app_thread
->
process_commands
(
false
,
false
);
rc
=
xrecv
(
msg_
,
flags_
);
ticks
=
0
;
ticks
=
0
;
return
xrecv
(
msg_
,
flags_
);
}
}
else
{
// In blocking scenario, commands are processed over and over again until
// we are able to fetch a message.
while
(
rc
!=
0
)
{
while
(
rc
!=
0
)
{
if
(
errno
!=
EAGAIN
)
if
(
errno
!=
EAGAIN
)
return
-
1
;
return
-
1
;
...
@@ -384,9 +388,7 @@ int zmq::socket_base_t::recv (::zmq_msg_t *msg_, int flags_)
...
@@ -384,9 +388,7 @@ int zmq::socket_base_t::recv (::zmq_msg_t *msg_, int flags_)
rc
=
xrecv
(
msg_
,
flags_
);
rc
=
xrecv
(
msg_
,
flags_
);
ticks
=
0
;
ticks
=
0
;
}
}
}
return
0
;
return
rc
;
}
}
int
zmq
::
socket_base_t
::
close
()
int
zmq
::
socket_base_t
::
close
()
...
...
src/tcp_listener.cpp
View file @
aff1f662
...
@@ -275,7 +275,7 @@ zmq::fd_t zmq::tcp_listener_t::accept ()
...
@@ -275,7 +275,7 @@ zmq::fd_t zmq::tcp_listener_t::accept ()
#if (defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_FREEBSD || \
#if (defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_FREEBSD || \
defined ZMQ_HAVE_OPENBSD || defined ZMQ_HAVE_OSX || \
defined ZMQ_HAVE_OPENBSD || defined ZMQ_HAVE_OSX || \
defined ZMQ_HAVE_OPENVMS)
defined ZMQ_HAVE_OPENVMS
|| defined ZMQ_HAVE_NETBSD
)
if
(
sock
==
-
1
&&
if
(
sock
==
-
1
&&
(
errno
==
EAGAIN
||
errno
==
EWOULDBLOCK
||
(
errno
==
EAGAIN
||
errno
==
EWOULDBLOCK
||
errno
==
EINTR
||
errno
==
ECONNABORTED
))
errno
==
EINTR
||
errno
==
ECONNABORTED
))
...
...
src/uuid.cpp
View file @
aff1f662
...
@@ -47,7 +47,7 @@ const char *zmq::uuid_t::to_string ()
...
@@ -47,7 +47,7 @@ const char *zmq::uuid_t::to_string ()
return
(
char
*
)
uuid_str
;
return
(
char
*
)
uuid_str
;
}
}
#elif defined ZMQ_HAVE_FREEBSD
#elif defined ZMQ_HAVE_FREEBSD
|| defined ZMQ_HAVE_NETBSD
#include <stdlib.h>
#include <stdlib.h>
#include <uuid.h>
#include <uuid.h>
...
...
src/uuid.hpp
View file @
aff1f662
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
#include "platform.hpp"
#include "platform.hpp"
#include "stdint.hpp"
#include "stdint.hpp"
#if defined ZMQ_HAVE_FREEBSD
#if defined ZMQ_HAVE_FREEBSD
|| defined ZMQ_HAVE_NETBSD
#include <uuid.h>
#include <uuid.h>
#elif defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_OSX
#elif defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_OSX
#include <uuid/uuid.h>
#include <uuid/uuid.h>
...
@@ -60,7 +60,7 @@ namespace zmq
...
@@ -60,7 +60,7 @@ namespace zmq
#endif
#endif
::
UUID
uuid
;
::
UUID
uuid
;
RPC_CSTR
uuid_str
;
RPC_CSTR
uuid_str
;
#elif defined ZMQ_HAVE_FREEBSD
#elif defined ZMQ_HAVE_FREEBSD
|| defined ZMQ_HAVE_NETBSD
::
uuid_t
uuid
;
::
uuid_t
uuid
;
char
*
uuid_str
;
char
*
uuid_str
;
#elif defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_OSX
#elif defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_OSX
...
...
src/zmq.cpp
View file @
aff1f662
...
@@ -37,7 +37,8 @@
...
@@ -37,7 +37,8 @@
#if defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_FREEBSD ||\
#if defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_FREEBSD ||\
defined ZMQ_HAVE_OPENBSD || defined ZMQ_HAVE_SOLARIS ||\
defined ZMQ_HAVE_OPENBSD || defined ZMQ_HAVE_SOLARIS ||\
defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_QNXNTO ||\
defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_QNXNTO ||\
defined ZMQ_HAVE_HPUX || defined ZMQ_HAVE_AIX
defined ZMQ_HAVE_HPUX || defined ZMQ_HAVE_AIX ||\
defined ZMQ_HAVE_NETBSD
#include <poll.h>
#include <poll.h>
#endif
#endif
...
@@ -325,7 +326,8 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
...
@@ -325,7 +326,8 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
#if defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_FREEBSD ||\
#if defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_FREEBSD ||\
defined ZMQ_HAVE_OPENBSD || defined ZMQ_HAVE_SOLARIS ||\
defined ZMQ_HAVE_OPENBSD || defined ZMQ_HAVE_SOLARIS ||\
defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_QNXNTO ||\
defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_QNXNTO ||\
defined ZMQ_HAVE_HPUX || defined ZMQ_HAVE_AIX
defined ZMQ_HAVE_HPUX || defined ZMQ_HAVE_AIX ||\
defined ZMQ_HAVE_NETBSD
pollfd
*
pollfds
=
(
pollfd
*
)
malloc
(
nitems_
*
sizeof
(
pollfd
));
pollfd
*
pollfds
=
(
pollfd
*
)
malloc
(
nitems_
*
sizeof
(
pollfd
));
zmq_assert
(
pollfds
);
zmq_assert
(
pollfds
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment