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
991b7fcc
Commit
991b7fcc
authored
May 22, 2012
by
Lourens Naudé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename zmq_monitor to zmq_ctx_set_monitor for compat with existing context specific APIs
parent
04f0e7f2
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
14 additions
and
14 deletions
+14
-14
Makefile.am
doc/Makefile.am
+1
-1
zmq.txt
doc/zmq.txt
+1
-1
zmq_monitor.txt
doc/zmq_monitor.txt
+9
-9
zmq.h
include/zmq.h
+1
-1
zmq.cpp
src/zmq.cpp
+1
-1
test_monitor.cpp
tests/test_monitor.cpp
+1
-1
No files found.
doc/Makefile.am
View file @
991b7fcc
MAN3
=
zmq_bind.3 zmq_close.3 zmq_connect.3 zmq_device.3
\
MAN3
=
zmq_bind.3 zmq_close.3 zmq_connect.3 zmq_device.3
\
zmq_ctx_new.3 zmq_ctx_destroy.3 zmq_ctx_get.3 zmq_ctx_set.3
\
zmq_ctx_new.3 zmq_ctx_destroy.3 zmq_ctx_get.3 zmq_ctx_set.3
\
zmq_init.3 zmq_term.3 zmq_monitor.3
\
zmq_init.3 zmq_term.3 zmq_
ctx_set_
monitor.3
\
zmq_msg_close.3 zmq_msg_copy.3 zmq_msg_data.3 zmq_msg_init.3
\
zmq_msg_close.3 zmq_msg_copy.3 zmq_msg_data.3 zmq_msg_init.3
\
zmq_msg_init_data.3 zmq_msg_init_size.3 zmq_msg_move.3 zmq_msg_size.3
\
zmq_msg_init_data.3 zmq_msg_init_size.3 zmq_msg_move.3 zmq_msg_size.3
\
zmq_msg_send.3 zmq_msg_recv.3
\
zmq_msg_send.3 zmq_msg_recv.3
\
...
...
doc/zmq.txt
View file @
991b7fcc
...
@@ -45,7 +45,7 @@ Destroy a 0MQ context::
...
@@ -45,7 +45,7 @@ Destroy a 0MQ context::
linkzmq:zmq_ctx_destroy[3]
linkzmq:zmq_ctx_destroy[3]
Monitor a 0MQ context::
Monitor a 0MQ context::
linkzmq:zmq_monitor[3]
linkzmq:zmq_
ctx_set_
monitor[3]
These deprecated functions let you create and destroy 'contexts':
These deprecated functions let you create and destroy 'contexts':
...
...
doc/zmq_monitor.txt
View file @
991b7fcc
zmq_monitor(3)
zmq_
ctx_set_
monitor(3)
==============
==============
========
NAME
NAME
----
----
zmq_monitor - register a monitoring callback
zmq_
ctx_set_
monitor - register a monitoring callback
SYNOPSIS
SYNOPSIS
--------
--------
*int zmq_monitor (void '*context', zmq_monitor_fn '*monitor');*
*int zmq_
ctx_set_
monitor (void '*context', zmq_monitor_fn '*monitor');*
DESCRIPTION
DESCRIPTION
-----------
-----------
The _zmq_monitor()_ function shall register a callback function specified by
The _zmq_
ctx_set_
monitor()_ function shall register a callback function specified by
the 'monitor' argument. This is an event sink for changes in per socket
the 'monitor' argument. This is an event sink for changes in per socket
connection and mailbox (work in progress) states.
connection and mailbox (work in progress) states.
.The _zmq_monitor()_ callback function is expected to have this prototype:
.The _zmq_
ctx_set_
monitor()_ callback function is expected to have this prototype:
----
----
typedef void (zmq_monitor_fn) (void *s, int event, zmq_event_data_t *data);
typedef void (zmq_monitor_fn) (void *s, int event, zmq_event_data_t *data);
----
----
...
@@ -28,7 +28,7 @@ The callback is global (per context), with the socket that triggered the event
...
@@ -28,7 +28,7 @@ The callback is global (per context), with the socket that triggered the event
passed to the handler as well. Each event also populates a 'zmq_event_data_t'
passed to the handler as well. Each event also populates a 'zmq_event_data_t'
union with additional metadata which can be used for correlation.
union with additional metadata which can be used for correlation.
CAUTION: _zmq_monitor()_ is intended for monitoring infrastructure / operations
CAUTION: _zmq_
ctx_set_
monitor()_ is intended for monitoring infrastructure / operations
concerns only - NOT BUSINESS LOGIC. An event is a representation of something
concerns only - NOT BUSINESS LOGIC. An event is a representation of something
that happened - you cannot change the past, but only react to them. The
that happened - you cannot change the past, but only react to them. The
implementation is also only concerned with a single session. No state of peers,
implementation is also only concerned with a single session. No state of peers,
...
@@ -158,7 +158,7 @@ data.disconnected.fd // socket descriptor
...
@@ -158,7 +158,7 @@ data.disconnected.fd // socket descriptor
RETURN VALUE
RETURN VALUE
------------
------------
The _zmq_monitor()_ function returns a value of 0 or greater if successful.
The _zmq_
ctx_set_
monitor()_ function returns a value of 0 or greater if successful.
Otherwise it returns `-1` and sets 'errno' to one of the values defined
Otherwise it returns `-1` and sets 'errno' to one of the values defined
below.
below.
...
@@ -188,7 +188,7 @@ void socket_monitor (void *s, int event_, zmq_event_data_t *data_)
...
@@ -188,7 +188,7 @@ void socket_monitor (void *s, int event_, zmq_event_data_t *data_)
}
}
void *context = zmq_ctx_new ();
void *context = zmq_ctx_new ();
int rc = zmq_monitor (context, socket_monitor);
int rc = zmq_
ctx_set_
monitor (context, socket_monitor);
assert (rc == 0);
assert (rc == 0);
void *pub = zmq_socket (context, ZMQ_PUB);
void *pub = zmq_socket (context, ZMQ_PUB);
assert (pub);
assert (pub);
...
...
include/zmq.h
View file @
991b7fcc
...
@@ -301,7 +301,7 @@ typedef union {
...
@@ -301,7 +301,7 @@ typedef union {
/* Callback template for socket state changes */
/* Callback template for socket state changes */
typedef
void
(
zmq_monitor_fn
)
(
void
*
s
,
int
event
,
zmq_event_data_t
*
data
);
typedef
void
(
zmq_monitor_fn
)
(
void
*
s
,
int
event
,
zmq_event_data_t
*
data
);
ZMQ_EXPORT
int
zmq_monitor
(
void
*
context
,
zmq_monitor_fn
*
monitor
);
ZMQ_EXPORT
int
zmq_
ctx_set_
monitor
(
void
*
context
,
zmq_monitor_fn
*
monitor
);
ZMQ_EXPORT
void
*
zmq_socket
(
void
*
,
int
type
);
ZMQ_EXPORT
void
*
zmq_socket
(
void
*
,
int
type
);
ZMQ_EXPORT
int
zmq_close
(
void
*
s
);
ZMQ_EXPORT
int
zmq_close
(
void
*
s
);
...
...
src/zmq.cpp
View file @
991b7fcc
...
@@ -205,7 +205,7 @@ int zmq_ctx_get (void *ctx_, int option_)
...
@@ -205,7 +205,7 @@ int zmq_ctx_get (void *ctx_, int option_)
return
((
zmq
::
ctx_t
*
)
ctx_
)
->
get
(
option_
);
return
((
zmq
::
ctx_t
*
)
ctx_
)
->
get
(
option_
);
}
}
int
zmq_monitor
(
void
*
ctx_
,
zmq_monitor_fn
*
monitor_
)
int
zmq_
ctx_set_
monitor
(
void
*
ctx_
,
zmq_monitor_fn
*
monitor_
)
{
{
if
(
!
ctx_
||
!
((
zmq
::
ctx_t
*
)
ctx_
)
->
check_tag
())
{
if
(
!
ctx_
||
!
((
zmq
::
ctx_t
*
)
ctx_
)
->
check_tag
())
{
errno
=
EFAULT
;
errno
=
EFAULT
;
...
...
tests/test_monitor.cpp
View file @
991b7fcc
...
@@ -84,7 +84,7 @@ int main (int argc, char *argv [])
...
@@ -84,7 +84,7 @@ int main (int argc, char *argv [])
void
*
ctx
=
zmq_init
(
1
);
void
*
ctx
=
zmq_init
(
1
);
assert
(
ctx
);
assert
(
ctx
);
// set socket monitor
// set socket monitor
rc
=
zmq_monitor
(
ctx
,
socket_monitor
);
rc
=
zmq_
ctx_set_
monitor
(
ctx
,
socket_monitor
);
assert
(
rc
==
0
);
assert
(
rc
==
0
);
void
*
rep
=
zmq_socket
(
ctx
,
ZMQ_REP
);
void
*
rep
=
zmq_socket
(
ctx
,
ZMQ_REP
);
assert
(
rep
);
assert
(
rep
);
...
...
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