diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-07-12 18:02:22 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-07-12 18:02:22 -0700 |
| commit | 85593e678c35c13ed2d37f7f22aa41b0b8d70825 (patch) | |
| tree | cad8a43cc83b4f4728134c380f7924bc8601f5fe /src/core/socket.c | |
| parent | ae920f90e2fa169db8867c722239069d750a1def (diff) | |
| download | nng-85593e678c35c13ed2d37f7f22aa41b0b8d70825.tar.gz nng-85593e678c35c13ed2d37f7f22aa41b0b8d70825.tar.bz2 nng-85593e678c35c13ed2d37f7f22aa41b0b8d70825.zip | |
Attempts to minimize races, remove unused nni_sock_mtx function.
We still have endpoint related races apparently; we need to examine
the possibility of handling endpoints much like we do pipes, which seem
to be race free.
Diffstat (limited to 'src/core/socket.c')
| -rw-r--r-- | src/core/socket.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/core/socket.c b/src/core/socket.c index c561b719..4be5a856 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -218,12 +218,6 @@ nni_sock_unnotify(nni_sock *sock, nni_notify *notify) NNI_FREE_STRUCT(notify); } -nni_mtx * -nni_sock_mtx(nni_sock *sock) -{ - return (&sock->s_mx); -} - static nni_msg * nni_sock_nullfilter(void *arg, nni_msg *mp) { @@ -509,6 +503,12 @@ nni_sock_shutdown(nni_sock *sock) nni_ep_close(ep); } + // Wait for the pipes to be reaped (there should not be any because + // we have already reaped the EPs.) + while ((pipe = nni_list_first(&sock->s_pipes)) != NULL) { + nni_cv_wait(&sock->s_cv); + } + // Wait for the eps to be reaped. while ((ep = nni_list_first(&sock->s_eps)) != NULL) { nni_list_remove(&sock->s_eps, ep); @@ -521,12 +521,6 @@ nni_sock_shutdown(nni_sock *sock) nni_mtx_lock(&sock->s_mx); } - // Wait for the pipes to be reaped (there should not be any because - // we have already reaped the EPs.) - while ((pipe = nni_list_first(&sock->s_pipes)) != NULL) { - nni_cv_wait(&sock->s_cv); - } - sock->s_sock_ops.sock_close(sock->s_data); nni_cv_wake(&sock->s_cv); |
