nanomsg
Home Download Documentation Development Community Support
NOTE: This documentation is for version 1.0.0 of nanomsg, but the latest released version is 1.1.5. Please see the documentation for 1.1.5 for the most up-to-date information.
nn_term(3)

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 informs all the open sockets that process termination is underway.

If a socket is blocked inside a blocking function, such as nn_recv(3), it will be unblocked and ETERM error will be returned to the user. Similarly, any subsequent attempt to invoke a socket function other than nn_close(3) after nn_term() was called will result in 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.

The nn_term() function itself is non-blocking.

EXAMPLE

s = nn_socket (AF_SP, NN_PAIR);
nn_term ();
rc = nn_send (s, "ABC", 3, 0);
assert (rc == -1 && errno == ETERM);

SEE ALSO

AUTHORS

"nanomsg" is a trademark of Garrett D'Amore.