nn_term - Man Page
notify all sockets about process termination
Synopsis
#include <nanomsg/nn.h>
void nn_term (void);
Description
To help with shutdown of multi-threaded programs nanomsg provides the nn_term() function which closes all open sockets, and releases all related resources.
If a socket is blocked inside a blocking function, such as nn_recv(3), it will be unblocked and EBADF error will be returned to the user. Subsequent calls on such sockets will also return EBADF.
Attempting to open a new socket with nn_socket(3) will result in an ETERM error.
If waiting for NN_SNDFD or NN_RCVFD using a polling function, such as poll() or select(), the call will unblock with both NN_SNDFD and NN_RCVFD signaled.
Example
s = nn_socket (AF_SP, NN_PAIR); nn_term (); rc = nn_send (s, "ABC", 3, 0); assert (rc == -1 && errno == EBADF);
See Also
Authors
Referenced By
2024-09-04 nanomsg 1.2.1