From 1b6e9985960a1079be81a576d52aa7f3fe47c92b Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Thu, 5 Jan 2017 18:02:22 -0800 Subject: Add nng_shutdown() for sockets to help avoid close race. Also we added a two phase shutdown for threads. --- src/core/socket.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/core/socket.h') diff --git a/src/core/socket.h b/src/core/socket.h index 5a0dbb84..68a7bc1c 100644 --- a/src/core/socket.h +++ b/src/core/socket.h @@ -37,6 +37,7 @@ struct nng_socket { nni_list s_reaps; // pipes to reap nni_thr s_reaper; + int s_ep_pend; // EP dial/listen in progress int s_closing; // Socket is closing int s_besteffort; // Best effort mode delivery int s_senderr; // Protocol state machine use @@ -46,7 +47,8 @@ struct nng_socket { }; extern int nni_sock_open(nni_sock **, uint16_t); -extern int nni_sock_close(nni_sock *); +extern void nni_sock_close(nni_sock *); +extern int nni_sock_shutdown(nni_sock *); extern uint16_t nni_sock_proto(nni_sock *); extern uint16_t nni_sock_peer(nni_sock *); extern int nni_sock_setopt(nni_sock *, int, const void *, size_t); -- cgit v1.2.3-70-g09d2