1NN_TERM(3) nanomsg 1.1.5 NN_TERM(3)
2
3
4
6 nn_term - notify all sockets about process termination
7
9 #include <nanomsg/nn.h>
10
11 void nn_term (void);
12
14 To help with shutdown of multi-threaded programs nanomsg provides the
15 nn_term() function which closes all open sockets, and releases all
16 related resources.
17
18 If a socket is blocked inside a blocking function, such as nn_recv(3),
19 it will be unblocked and EBADF error will be returned to the user.
20 Subsequent calls on such sockets will also return EBADF.
21
22 Attempting to open a new socket with nn_socket(3) will result in an
23 ETERM error.
24
25 If waiting for NN_SNDFD or NN_RCVFD using a polling function, such as
26 poll() or select(), the call will unblock with both NN_SNDFD and
27 NN_RCVFD signaled.
28
30 s = nn_socket (AF_SP, NN_PAIR);
31 nn_term ();
32 rc = nn_send (s, "ABC", 3, 0);
33 assert (rc == -1 && errno == EBADF);
34
36 nn_close(3) nn_send(3) nn_socket(3) nn_recv(3) nanomsg(7)
37
39 Martin Sustrik <sustrik@250bpm.com> Garrett D’Amore
40 <garrett@damore.org>
41
42
43
44 2020-08-24 NN_TERM(3)