mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-27 15:41:05 +08:00
Rename type zmq_monitor_fn -> zmq_monitor for a more natural callback definition API (zmq_monitor type, monitor.function callback)
This commit is contained in:
parent
06cce15479
commit
e13b3723b8
@ -461,7 +461,7 @@ Registers a callback function / event sink for changes in underlying socket stat
|
||||
The default value of `NULL` means no monitor callback function.
|
||||
|
||||
[horizontal]
|
||||
Option value type:: zmq_monitor_fn
|
||||
Option value type:: zmq_monitor
|
||||
Option value unit:: N/A
|
||||
Default value:: no callback function
|
||||
Applicable socket types:: all
|
||||
|
@ -434,7 +434,7 @@ Applicable socket types:: all listening sockets, when using TCP transports.
|
||||
ZMQ_MONITOR: Registers a callback for socket state changes
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Registers a callback function / event sink for changes in underlying socket state.
|
||||
Expected signature of function member of zmq_monitor_fn union is `void (*function)(void *s, int event, zmq_event_data_t *data);`
|
||||
Expected signature of function member of zmq_monitor union is `void (*function)(void *s, int event, zmq_event_data_t *data);`
|
||||
To remove the callback function call `zmq_setsockopt(socket, ZMQ_MONITOR, NULL, 0)`
|
||||
The default value of `NULL` means no monitor callback function.
|
||||
Supported events are :
|
||||
@ -466,7 +466,7 @@ callback function as severe latency there will block the socket's application th
|
||||
Only tcp and ipc specific transport events are supported in this initial implementation.
|
||||
|
||||
[horizontal]
|
||||
Option value type:: zmq_monitor_fn
|
||||
Option value type:: zmq_monitor
|
||||
Option value unit:: N/A
|
||||
Default value:: no callback function
|
||||
Applicable socket types:: all
|
||||
|
@ -303,7 +303,7 @@ typedef union {
|
||||
typedef union {
|
||||
void *object;
|
||||
void (*function)(void *s, int event, zmq_event_data_t *data);
|
||||
} zmq_monitor_fn;
|
||||
} zmq_monitor;
|
||||
|
||||
ZMQ_EXPORT void *zmq_socket (void *, int type);
|
||||
ZMQ_EXPORT int zmq_close (void *s);
|
||||
|
@ -325,7 +325,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
monitor = *((zmq_monitor_fn**) &optval_);
|
||||
monitor = *((zmq_monitor**) &optval_);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -550,8 +550,8 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
*((zmq_monitor_fn**) &optval_) = monitor;
|
||||
*optvallen_ = sizeof (zmq_monitor_fn*);
|
||||
*((zmq_monitor**) &optval_) = monitor;
|
||||
*optvallen_ = sizeof (zmq_monitor*);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -125,8 +125,8 @@ namespace zmq
|
||||
typedef std::vector <tcp_address_mask_t> tcp_accept_filters_t;
|
||||
tcp_accept_filters_t tcp_accept_filters;
|
||||
|
||||
// Connection and exceptional state callback function
|
||||
zmq_monitor_fn *monitor;
|
||||
// Connection and exceptional state callback
|
||||
zmq_monitor *monitor;
|
||||
|
||||
// ID of the socket.
|
||||
int socket_id;
|
||||
|
@ -99,7 +99,7 @@ int main (int argc, char *argv [])
|
||||
assert (rep);
|
||||
|
||||
// Expects failure - invalid size
|
||||
zmq_monitor_fn monitor;
|
||||
zmq_monitor monitor;
|
||||
monitor.function = listening_sock_monitor;
|
||||
|
||||
rc = zmq_setsockopt (rep, ZMQ_MONITOR, &monitor, 20);
|
||||
|
Loading…
x
Reference in New Issue
Block a user