mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-20 02:17:55 +00: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.
|
The default value of `NULL` means no monitor callback function.
|
||||||
|
|
||||||
[horizontal]
|
[horizontal]
|
||||||
Option value type:: zmq_monitor_fn
|
Option value type:: zmq_monitor
|
||||||
Option value unit:: N/A
|
Option value unit:: N/A
|
||||||
Default value:: no callback function
|
Default value:: no callback function
|
||||||
Applicable socket types:: all
|
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
|
ZMQ_MONITOR: Registers a callback for socket state changes
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
Registers a callback function / event sink for changes in underlying socket state.
|
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)`
|
To remove the callback function call `zmq_setsockopt(socket, ZMQ_MONITOR, NULL, 0)`
|
||||||
The default value of `NULL` means no monitor callback function.
|
The default value of `NULL` means no monitor callback function.
|
||||||
Supported events are :
|
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.
|
Only tcp and ipc specific transport events are supported in this initial implementation.
|
||||||
|
|
||||||
[horizontal]
|
[horizontal]
|
||||||
Option value type:: zmq_monitor_fn
|
Option value type:: zmq_monitor
|
||||||
Option value unit:: N/A
|
Option value unit:: N/A
|
||||||
Default value:: no callback function
|
Default value:: no callback function
|
||||||
Applicable socket types:: all
|
Applicable socket types:: all
|
||||||
|
@ -303,7 +303,7 @@ typedef union {
|
|||||||
typedef union {
|
typedef union {
|
||||||
void *object;
|
void *object;
|
||||||
void (*function)(void *s, int event, zmq_event_data_t *data);
|
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 void *zmq_socket (void *, int type);
|
||||||
ZMQ_EXPORT int zmq_close (void *s);
|
ZMQ_EXPORT int zmq_close (void *s);
|
||||||
|
@ -325,7 +325,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
|
|||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
monitor = *((zmq_monitor_fn**) &optval_);
|
monitor = *((zmq_monitor**) &optval_);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -550,8 +550,8 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
|
|||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
*((zmq_monitor_fn**) &optval_) = monitor;
|
*((zmq_monitor**) &optval_) = monitor;
|
||||||
*optvallen_ = sizeof (zmq_monitor_fn*);
|
*optvallen_ = sizeof (zmq_monitor*);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,8 +125,8 @@ namespace zmq
|
|||||||
typedef std::vector <tcp_address_mask_t> tcp_accept_filters_t;
|
typedef std::vector <tcp_address_mask_t> tcp_accept_filters_t;
|
||||||
tcp_accept_filters_t tcp_accept_filters;
|
tcp_accept_filters_t tcp_accept_filters;
|
||||||
|
|
||||||
// Connection and exceptional state callback function
|
// Connection and exceptional state callback
|
||||||
zmq_monitor_fn *monitor;
|
zmq_monitor *monitor;
|
||||||
|
|
||||||
// ID of the socket.
|
// ID of the socket.
|
||||||
int socket_id;
|
int socket_id;
|
||||||
|
@ -99,7 +99,7 @@ int main (int argc, char *argv [])
|
|||||||
assert (rep);
|
assert (rep);
|
||||||
|
|
||||||
// Expects failure - invalid size
|
// Expects failure - invalid size
|
||||||
zmq_monitor_fn monitor;
|
zmq_monitor monitor;
|
||||||
monitor.function = listening_sock_monitor;
|
monitor.function = listening_sock_monitor;
|
||||||
|
|
||||||
rc = zmq_setsockopt (rep, ZMQ_MONITOR, &monitor, 20);
|
rc = zmq_setsockopt (rep, ZMQ_MONITOR, &monitor, 20);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user