diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-01-05 18:02:22 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-01-05 18:02:22 -0800 |
| commit | 1b6e9985960a1079be81a576d52aa7f3fe47c92b (patch) | |
| tree | 2f6c9b33571cf30e28ca721064a9c0d038be4c42 /src/nng.h | |
| parent | b17703d1e708a99e9a46ceb012676dc89df40df5 (diff) | |
| download | nng-1b6e9985960a1079be81a576d52aa7f3fe47c92b.tar.gz nng-1b6e9985960a1079be81a576d52aa7f3fe47c92b.tar.bz2 nng-1b6e9985960a1079be81a576d52aa7f3fe47c92b.zip | |
Add nng_shutdown() for sockets to help avoid close race.
Also we added a two phase shutdown for threads.
Diffstat (limited to 'src/nng.h')
| -rw-r--r-- | src/nng.h | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -54,7 +54,14 @@ NNG_DECL int nng_open(nng_socket **, uint16_t proto); // error to reference the socket in any way after this is called. Likewise, // it is an error to reference any resources such as endpoints or // pipes associated with the socket. -NNG_DECL int nng_close(nng_socket *); +NNG_DECL void nng_close(nng_socket *); + +// nng_shutdown shuts down the socket. This causes any threads doing +// work for the socket or blocked in socket functions to be woken (and +// return NNG_ECLOSED). The socket resources are still present, so it +// is safe to call other functions; they will just return NNG_ECLOSED. +// A call to nng_close is still required to release the resources. +NNG_DECL int nng_shutdown(nng_socket *); // nng_protocol returns the protocol number of the socket. uint16_t nng_protocol(nng_socket *); |
